Hi guys.
I hope you can help me please.
I am wanting to generate my page <title>’s automatically to save our time a bit. However, this function I found doesn’t do what we need…
[code=php]
function getScriptName($url) {
$name = “Undefined Page”;
$pattern = “//[a-zA-Z0-9_-]+.php/”;
preg_match($pattern ,$url, $matches);
if(is_array($matches) && !empty($matches[0])) {
$name = $matches[0];
}
$name = str_replace(“/”, “”, $name);
$name = preg_replace(“/.(php¦¦html)/”, “”, $name);
return $name;
}
This just states “index.php” if we’re in /staff/index.php for example
What we want:
[code]
URL Should show
—————————————————————-
/staff/index.php Staff
/staff/manager/deluser.php Staff – Manager – Deluser
/staff/manager/index.php Staff – Manager
/index.php Index
Any help with this would be greatly appreciated