Slideshows in iRev
J. Landman Gay
jacque at hyperactivesw.com
Mon Dec 21 01:16:59 EST 2009
Sarah (and Sivakatirswami) wrote:
> I would be very interested to see your code for this slideshow please.
Ok, but it's almost too easy to post. There's a folder called
"cgiphotos" of flower images in the same directory as the irev page.
Inside that folder is also a text file named "cgiphotos.txt", which
contains a list of all the available photos. Each line of the list has a
file name as item one and a description as item two, like this:
In the html where I want the slideshow image to display, I choose a
random image and stuff that into the img src tag:
put any line of url ("file:cgiphotos/cgiphotos.txt") into tFlower
<img src="cgiphotos/<?rev put item 1 of tFlower ?>" width="320"
height="240" border="1" />
And later at the bottom of the page where I want the description to appear:
<?rev put item 2 of tFlower" ?>
I just use the refresh directive in a header to reload the page every
<meta HTTP-EQUIV="refresh" CONTENT="10">
Pretty easy. If you wanted the slide show to be in a strict order, it
would be harder. I think you'd need to either set up cookies, or write
the current line to disk and read that for each reload, then update the
counter in the text file with the next line number.
Or if you didn't want to keep a text file, you could read the files in
the directory and get the list that way too.
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the Use-livecode