tarun Posted February 4, 2007 Share Posted February 4, 2007 I Need Some Help I Want To Have A Different Page Title (<title>) Depending On The URL Ive Got This But I Know That Its Wrong <?PHP if $_SERVER['PHP_SELF'] == "index.php"{ echo "<title>HomePage</title>"; } if $_SERVER['PHP_SELF'] == "chat.php"{ echo "<title>ChatRoom</title>"; } else{ echo "<title>PageNotFound</title>" } ?> Thnx Tarun Link to comment https://forums.phpfreaks.com/topic/37037-different-title-depending-on-url/ Share on other sites More sharing options...
Orio Posted February 4, 2007 Share Posted February 4, 2007 Use basename(). <?PHP if (basename($_SERVER['PHP_SELF']) == "index.php") echo "<title>HomePage</title>"; elseif(basename($_SERVER['PHP_SELF']) == "chat.php") echo "<title>ChatRoom</title>"; else echo "PageNotFound"; ?> Orio. Link to comment https://forums.phpfreaks.com/topic/37037-different-title-depending-on-url/#findComment-176853 Share on other sites More sharing options...
tarun Posted February 4, 2007 Author Share Posted February 4, 2007 Wow Thank You I Really Appreciate That Link to comment https://forums.phpfreaks.com/topic/37037-different-title-depending-on-url/#findComment-176856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.