I use the following function to create links to files in the same catalog
(and format the link text):

function createLink() {
 $handle=opendir(".");
     while ($file = readdir($handle)){
          if (($file == ".") || ($file == "..") || (ereg("index", $file) ==
true) || ($file == basename ($PHP_SELF))) { continue; }
          if(is_file($file)) { $files[] = $file; }
     }
     $link = sort($files);
     foreach($files as $file) {
      $linktext = substr_replace($file,'',0,3);
      $linktext = substr_replace($linktext,'',-4);
      $linktext = ucfirst($linktext);
      echo "&nbsp;<A HREF=\"$file\" CLASS=\"light\">$linktext</A>\n";
     }
     return true;
}

The part $file == basename ($PHP_SELF) is intended to not link to the
calling document, but this part doesn't work. So, what shall I do instead?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to