You could agree on a file naming scheme to get the caption in there
automatically. Here’s how I would do that:
Name your files in a pattern like this:
- 01_here’s_a_little_song_I_wrote.jpg
- 02_you_might_want_to_learn_it_note_for_note.jpg
- 03_don’t_worry–be_happy.jpg
Then you upload those files into a folder inside your site root, and
using PHP, read the directory of files into an array so you can
process them further:
<?php
$base = dirname(__FILE__);
$root = $_SERVER['DOCUMENT_ROOT'];
$prefix = str_replace($root,'',$base) . '/';
$dir = scandir($base);
foreach($dir as $f){
if(!is_dir($base . '/' . $f) && substr($f,-3) == 'jpg'){
$caption = preg_replace('/d+_(.+?)/','$1',substr($f,
0,strrpos($f,'.')));
$caption = htmlspecialchars(str_replace('_',' ',$caption));
print '<p><img src="' . $prefix . $f . '" alt="' . $caption . '" /
><br />' . $caption . '</p>';
}
}
?>
Save that code in a text file named index.php and put it in the same
folder as the photos. When you browse to the folder, you should get a
single paragraph for each photo in that folder, with the filename
processed into the caption. (The leading numbers and underscore and
the .jpg extension are stripped off, then the remaining text has its
underscores turned back into spaces.)
You can style these paragraphs to line up like a slide sorter, or you
could expand the example above to use different HTML so you could
style it up more elaborately. (The line that begins with the print
command is the only part of this that creates any output, all the rest
is juggling the folder and filenames.)
To use this as an include within Freeway, just include it in your
layout (using a Markup Item) where you want the photos to appear on
your page.
Walter
On Dec 4, 2009, at 1:23 PM, Peter Tucker wrote:
I’d like to make a page which has a matrix of graphics each with a
caption
underneath, that my son can update without coming back to me. To
change in
FW
It’s pretty easy to link to an image as a passthrough, that he can
change,
but I’d like to do the same with text, eg calling text from a file:
pano1.txt
I thought php would be the way to go, I’ve seen includes, but don’t
know
enough about php for that to be really useful. I’ve also had a look
to see
if there are any actions but have not found anything immediately
useful.
Or is there another approach I should take?
Time to shout for the tech whizzes here!
Best wishes Peter
–
================================
Peter Tucker, Oxford UK email@hidden
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options