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

Posted by Martin Jay on 06/10/06 02:11

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.

>?>

--
Martin Jay
Phone/SMS: +44 7740 191877
Fax: +44 870 915 2124

 

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

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