You are here: Re: Extracting the File Name????? « All PHP « IT news, forums, messages
Re: Extracting the File Name?????

Posted by Ian Rutgers on 06/10/06 15:16

"Martin Jay" <martin@spam-free.org.uk> wrote in message
news:4PJS3eD6oiiEFwdk@spam-free.org.uk...
> In message <A3nig.4392$Mn5.3652@pd7tw3no>, Ian Rutgers
> <irutgers@otima.ca> writes
>>I am trying to extract the file name from a URL in order to serve up the
>>correct navigation ... 'cept it ain't working ... would someone please
>>advise me as to where I am going wrong ... thanks in advance! (The code
>>below is contained in an include file)
>>
>><h2>philosophy</h2>
>><?
>>$path= $_SERVER('PHP_SELF');
>
> This should be:
>
> $path= $_SERVER['PHP_SELF'];
>
> Note the square brackets.
>
>>$file = basename($path, ".php");
>>print $file;
>>switch($file){
>> case "index":
>> print "<a href="index.php" title="studio philosophy"
>>id="selectedTopic">studio philosophy</a>";
>
> You'll also need to escape " in the HTML:
>
> print "<a href=\"index.php\" title=\"studio philosophy\"
>>id=\"selectedTopic\">studio philosophy</a>";
>
> or:
>
> print '<a href="index.php" title="studio philosophy"
>>id="selectedTopic">studio philosophy</a>';
>
> [snip]
>> default:
>> print "there is an error";
>
> There should be a } here.
>
>>?>
>
Thx Martin ... I have made the changes and the code now works as it should.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация