Go Back   CP Web Hosting - reseller hosting > Server Scripting > PHP
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-04-2007, 11:55 AM
Senior Member
 
Join Date: Apr 2007
Posts: 347
Default slide show script

Hi,

Does anyone know of a simply slide show script that just have the image and then a previous and next button. Also it needs to run from a folder that i specify.

plz. help me
Reply With Quote
  #2 (permalink)  
Old 07-04-2007, 11:59 AM
Senior Member
 
Join Date: Mar 2007
Posts: 193
Arrow

Try this, this will fulfill your requirement

Code:
<?php
$my_folder = "my_images";
$files = array();

if ($handle = opendir($my_folder))
{
    while (false !== ($file = readdir($handle)))
    {
        if ($file != "." && $file != "..")
            array_push($files,$file);
    }
    closedir($handle);
}
if ( isset($_GET['id']) )
    $id = $_GET['id'];
else
    $id = 0;

?>

<img src="<?=$my_folder."/".$files[$id];?>" alt="" /><br />

<?php
if ($id > 0)
    echo "<p style=\"width:200px; float:left;\"><a href=\"".$_SERVER['PHP_SELF']."?id=".($id-1)."\">Previous</a></p>";
else
    echo "<p style=\"width:200px; float:left;\">Previous</p>";

if ($id <= count($files) - 2)
    echo "<p style=\"float:left;\"><a href=\"".$_SERVER['PHP_SELF']."?id=".($id+1)."\">Next</a></p>";
else
    echo "<p style=\"float:left;\">Next</p>";
?>
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:14 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0