How can I link to all BUT $PHP_SELF
| From: | �ystein H�land | Date: | Wed, 05 Feb 2003 20:21:22 +0000 |
| Subject: | How can I link to all BUT $PHP_SELF | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134471@lists.php.net to get a copy of this message | ||
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 " <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?