Hello everyone,
its bin a long time since I have bin here. Anyway!
I am building a program and I need a navigation bar for it. So what I did was I made a folder called Pages with the files "Home" and "Copy of Home" in it, I then made a Readdir function
The code follows
EDIT: I just added to the code, it didn't fix it but it now checks to see if a image exists and echos the image instead of the text here's the updated code
PHP Code:
$root = "C:/Inetpub/wwwroot/www/***********.Com/"; $root2 = "http://www.***********.Com/"; $dir = opendir($root."/New/pages/");
//List files in images directory while (($file = readdir($dir)) !== false) { if ($file != "." && $file != "..") { if (file_exists($root.'/New/Images/Navbar/'.$file.'.JPG')){ echo "<a href=\"./index.php?p=".$file."\"> <img border=\"0\" src=\"./Images/Navbar/".$file.".JPG\"></a>"; echo " "; }else{ echo "<a href=\"./index.php?p=".$file." \"> $file"."</a> "; } } }
closedir($dir);
the output is
I cant find out how to make a custom order of the output though,
for instance instead of
i want to make it
and have the ability to change the order..
if you could help that would be great.
-Mark Masterson
Last edited by MRMasterson; 11-28-2008 at 12:22 PM..
|