Jump to content

Create directory links like "PHP Freaks Forums > PHP and MySQL > PHP Help > "


farkewie

Recommended Posts

Hi i have a page on my localnetwork where i can browse through the folders on the HDD, all is working good but

i want links up the top to go back through all the directorys you have just gone through,

 

 

here is my code

$links = explode( "/", $_GET['dir'], 2 );
echo $_GET['dir'] . "<br/><br/><br/>";
echo $links . "<br/><br/><br/>";
if ( ($_GET['dir']) != "" and is_array($links) )
{
     for ( $i = 1; $i <= sizeof($links); $i++ )
     {
         if ( $links[$i] != "" )
         {
             foreach ( $links as $link )
             {
                 echo " -> <a href=\"{$_SERVER[php_SELF]}?inc=z&dir={$link}\">$link</a> ->";
             }


         }
     }

}

 

now i know i have a start here because it is creating links

but,

 

it creates 2 of everything,

 

and i need it if

say dir looks like this" /di1/dir2/dir3/dir4"

 

when i click on dir1 the link wil be dir=dir1

when i click on dir3 the link will be dir=/di1/dir2/dir3/

 

i have been googleing i made it this far but im stuck now...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.