stevet70 Posted April 8, 2009 Share Posted April 8, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153146-solved-simple-dynamic-slideshow/ Share on other sites More sharing options...
Yesideez Posted April 8, 2009 Share Posted April 8, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/153146-solved-simple-dynamic-slideshow/#findComment-804595 Share on other sites More sharing options...
stevet70 Posted April 8, 2009 Author Share Posted April 8, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153146-solved-simple-dynamic-slideshow/#findComment-804631 Share on other sites More sharing options...
Yesideez Posted April 8, 2009 Share Posted April 8, 2009 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/153146-solved-simple-dynamic-slideshow/#findComment-804637 Share on other sites More sharing options...
stevet70 Posted April 8, 2009 Author Share Posted April 8, 2009 Excellent, many thanks for your help, it's now working perfectly from the database Quote Link to comment https://forums.phpfreaks.com/topic/153146-solved-simple-dynamic-slideshow/#findComment-804685 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.