Jump to content

Recommended Posts

Here's an example of a slideshow I need to implement as part of a database driven website

http://www.chisenhale.org.uk/archive/exhibitions/2008_lucy_skaer.php

 

This version is on a static page, using some javascript I've modified to suit.

 

However what I seem to be searching in vain for is a script/app/? that will do what the above does (manual click through slideshow with captions and no fancy transitions) but can be filled with an array from a database table.

 

The number of images with corresponding cations will vary, hence I want to be able to use something that's array friendly

 

Any pointers or examples?

 

I've been looking through JQuery for something suitable, but am yet to find anything that I can customize properly or easily

 

Any help would be much appreciated

Link to comment
https://forums.phpfreaks.com/topic/153146-solved-simple-dynamic-slideshow/
Share on other sites

If you view the source to the page you posted you'll see the slideshow was written by someone called Patrick Fitzgerald and can be downloaded from here:

 

http://slideshow.barelyfitz.com/

 

The source also looks very simple to implement - include the .js file and write some small JS to declare your images and captions.

 

I can't see why you can't write some PHP to generate the Javascript that defines the image information from a database.

thanks Yesideez,

 

I had started to look at doing that, though my initial results just didn't work and I was concerned that in my (somewhat limited) experience of PHP/MySQL and using arrays to list things, the lists of images and/or text had always been generated within table or list elements. The way this particular script works is different, eg:

s = new slide();
s.src =  "images/2008_simon_martin_02.jpg";
s.text = "Installation, 2008";
ss.add_slide(s);

s = new slide();
s.src =  "images/2008_simon_martin_03.jpg";
s.text = "Installation, 2008";
ss.add_slide(s);

 

 

It also needs to be able to pull out the first image and caption from the generated array to show in the initial state of the slideshow - again, something I haven't done before.

 

Time I worked it out I guess!

 

thanks again

The actual code it's building is this:

ss = new slideshow("ss");

s = new slide();
s.src =  "images/2008_lucy_skaer_02.jpg";
s.text = "Zero Table, 2008";
ss.add_slide(s);

s = new slide();
s.src =  "images/2008_lucy_skaer_03.jpg";
s.text = "The Great Wave & The Deluge, 2007";
ss.add_slide(s);

s = new slide();
s.src =  "images/2008_lucy_skaer_04.jpg";
s.text = "Untitled (The Siege), 2008";
ss.add_slide(s);

 

Let's say all your image data is in a table called `images`...

$query=mysql_query("SELECT * FROM images");
echo 'ss = new slideshow("ss");';
while ($row=mysql_fetch_assoc($query)) { ?>
s = new slide();
s.src =  "images/<?php echo $row['filename']; ?>";
s.text = "<?php echo $row['caption']; ?>";
ss.add_slide(s);
<?php } ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.