Mostra notizie nelle discussioni
Avatar
Scritto da
Non Autenticato
il 2008-08-02 19:35:00.0 alle 2008-08-02 19:35:00.0
DIRECTORY-NAVIGATION-LINKS.PHP
<?
function directories()
         {
         $directory = $_SERVER["PHP_SELF"];

         $directories = array();

         $next_slash = 0;

         do {//Creates an array with all the parent folders
             //of the file where this function is called.
            $next_slash = strpos($directory, "/", $next_slash);

            if($next_slash !== false)
              {
              $next_slash++;
              $directories[count($directories)] = substr($directory, 0, $next_slash);
              }

            } while($next_slash !== false);

         return($directories);
         }

//Uses the directories() function to create the links.
function directory_navigation_links()
         {
         $directories = directories();

         $links = "";

         for($index = 0; $index < count($directories); $index++)
            {
            //Handling the display is a little harder than the links themselves.
            $dir_name = substr($directories[$index], 0, strlen($directories[$index]) - 1);

            $dir_name = substr($dir_name, strrpos($dir_name, "/") + 1, strlen($dir_name) - 1);

            if($dir_name == "") $dir_name = "home";

            $links .= "<a href=\"" . $directories[$index] . "\">" . $dir_name . "</a>  ";
            }

         return($links);
         }
?>

166686

Pagina generata in 8 millisecondi

Utenti attivi: 36 nell'ultimo minuto, 99 negli ultimi cinque minuti, 144 negli ultimi 15 minuti