Re: Dynamic Titles
| From: | David Robley | Date: | Fri, 12 Jun 2009 07:34:27 +0000 |
| Subject: | Re: Dynamic Titles | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-293968@lists.php.net to get a copy of this message | ||
Austin Caudill wrote:
> Hello, im trying to make the CMS system im using more SEO friendly by
> giving each page it's own title. Right now, the system assigns all pages
> the same general title. I would like to use PHP to discertain which page
> is being viewed and in turn, which title should be used.
>
> I have put in the title tags the variable "$title". As for the PHP im
> using, I scripted the following:
>
> $url =
> "http://'.$_SERVER['SERVER_NAME']''.$_SERVER['REQUEST_URI']'";
> switch ( $url )
> {
> default:
> $title = "Photoshop tutorials, Flash tutorials, and more! Newtuts Tutorial
> Search"; break;
>
> case "$config[HTTP_SERVER]help.php" :
> $title = "Newtuts Help";
> break;
> }
>
> Right now, im getting this error:
> Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
> T_STRING or T_VARIABLE or T_NUM_STRING in
> /home/a7201901/public_html/includes/classes/tutorial.php on line 803
>
> Can someone please help me with this?
>
>
>
> Thanks!
I'm guessing that line 803 is
$url = "http://'.$_SERVER['SERVER_NAME']''.$_SERVER['REQUEST_URI']'";
which is full of mismatched quotes :-) Try any of
$url = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
$url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
Cheers
--
David Robley
Life is only as long as you live it.
Today is Pungenday, the 17th day of Confusion in the YOLD 3175.