imperium2335 Posted April 16, 2009 Share Posted April 16, 2009 How do I get my script to read the file ahead of the one that is currently selected? I want to be able to inject two images, the current file and the next, then move to the next two etc. The echo will be whats going to go into a file, that is later though. $dir = "/" //Directory containing the images. $openzone = @opendir($dir) ; for($file = readdir($openzone)) { $idnumber++ ; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>' . "$title" . '</title> <meta name="keywords" content="' . "$keywords" . '" />' . ' <meta name="description" content="" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="http://www.cake-photos.com/cakes-css.css" rel="stylesheet" type="text/css" /> </head> <body> <?PHP $currentimage =' . "$idnumber" . ' <div id="page"><?PHP include "/home/caketph/public_html/includes/headnav.html" ?> <div id="head"></div> <div id="search"> <?PHP include "/home/caketph/public_html/includes/header-search.html"?> </div> <div id="sidebar"> <?PHP include "/home/caketph/public_html/includes/sidenav.html" ?> </div> <div id="main"> <img src="' . "$firstimage" . '" class="ralign" /> <h1>' . "$headtag" . '</h1> <h2></h2> </div> </div> <div id="rightzone"> <?PHP include "/home/caketph/public_html/php/random.php" ; ?> </div> <div id="footer"> <?PHP include "/home/caketph/public_html/includes/footer.html" ; ?> </div> </body> </html>' ; } Quote Link to comment Share on other sites More sharing options...
keeB Posted April 16, 2009 Share Posted April 16, 2009 I believe you're looking for http://us3.php.net/fseek Quote Link to comment Share on other sites More sharing options...
imperium2335 Posted April 16, 2009 Author Share Posted April 16, 2009 Hi, thanks for your help, but i tried another way and it worked: I probly didnt explain what i wanted very well, sorry. while($firstfile = readdir($openzone)) { if($firstfile != '.' && $firstfile != '..' && !is_dir($dir.'/'.$firstfile)) { $firstimage = $dir . '/' . $firstfile ; $secondimage = $dir . '/' . readdir($openzone) ; Quote Link to comment 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.