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]
|