Aiden Doyle Aiden Doyle - 2 months ago 14
HTML Question

Dynamic page title based on url

Hi lets say my url is

how could I dynamically add a page title of the last part of the url which in this case is music. but as the the url changes how to grab the last part of that url.


Omi Omi

Try this:

<title><?php echo basename($_SERVER['REQUEST_URI']); ?></title>


 <title><?php echo  trim($_SERVER["REQUEST_URI"],"/");?></title>