Aiden Doyle Aiden Doyle - 1 year ago 48
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
Answer Source

Try this:

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


 <title><?php echo  trim($_SERVER["REQUEST_URI"],"/");?></title>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download