PDA

View Full Version : Is this possible? (automated browser title)


Mosqwik
09-21-2007, 08:34 PM
Hi,
Something that would be really useful for a new project im working on would be to have automated browser titles using some php code in the <title> tags.
The only way I can think of doing this is by having the php code read the url im using for navigation, e.g. /windows/atari2600/ and use that data, edit it and have it display as 'Windows > Atari 2600'
Has this kind of thing been done before? are there any other common ways of doing this? Also are there any tutorials around?
Thanks!

Hitch
12-28-2007, 07:42 PM
Yes, you're right, you can take the URL and convert it into a nice-looking string. Code like this:

$str = $_SERVER['REQUEST_URI'];
$str = preg_replace("/\//", " >> ", $str);
echo "<title>$str</title>";

Look into the PHP manual for all of these functions :)