Pls help - Need to set 'Dynamic Title' - pHp.

They have: 15 posts

Joined: Dec 2005

Hi,
I want to have the title tag based on its file name.
The file something.php should get title as Something and nothing.php should get Nothing.

Could someone tell me how to do this?

Thanks in advance.

CptAwesome's picture

He has: 370 posts

Joined: Dec 2004

<?
$page = $_SERVER[SCRIPT_NAME]; // get name
$page = str_replace('.php','',$page); // strip .php, if the file extension/case varies, you might want to use preg_replace or ereg_replace
$page = ucfirst($page); // Capitalizes The First Letter Of The String
echo $page; // You can include a file like this, or echo the whole title tag or whatever
?>
'

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.