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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.