Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-28-2008, 01:10 AM PHP ReadDIR Help
Junior Talker

Posts: 3
Name: Mark Masterson
Location: New Yorj
Trades: 0
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
Quote:
Copy of Home
Home
I cant find out how to make a custom order of the output though,
for instance instead of
Quote:
Copy of Home
Home
i want to make it

Quote:
Home
Copy of Home
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..
MRMasterson is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-29-2008, 12:15 AM Re: PHP ReadDIR Help
Junior Talker

Posts: 3
Name: Mark Masterson
Location: New Yorj
Trades: 0
bumpp
MRMasterson is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP ReadDIR Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10123 seconds with 12 queries