Re: How can I link to all BUT $PHP_SELF
| From: | Greg Beaver | Date: | Wed, 05 Feb 2003 21:45:22 +0000 |
| Subject: | Re: How can I link to all BUT $PHP_SELF | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134491@lists.php.net to get a copy of this message | ||
Try this out (untested)
(basename ($file) == basename ($_SERVER['PATH_TRANSLATED'])))
Greg
--
phpDocumentor 1.2.0beta3 is out
http://www.phpdoc.org
"ØYstein HåLand" <molen@mbox302.swipnet.se> wrote in message
news:20030205202142.74994.qmail@pb1.pair.com...
> 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?
>
>