Hello, I’m trying to change the page titles on a site I’m working on using PHP but I’m not sure how to do it. Each page comes from the index.php page so the page URL’s all look something like this:
/index.php?page=about
/index.php?page=contact
I have found some code that seems like it’s close but it’s only using the “Transportation Insurance” title and applying that to all of the pages:
[php]
<?php $title; $path=$_SERVER['PHP_SELF']; $page=basename($path); switch("$page") { case 'index.php': $title = 'Transportation Insurance'; break; case 'index.php?page=home': $title = 'Transportation Insurance'; break; case 'index.php?page=newsletter': $title = 'Newsletter'; break; case 'index.php?page=privacy': $title = 'Privacy Policy'; break; case 'index.php?page=links': $title = 'Links'; break; case 'index.php?page=contact': $title = 'Contact Us'; break; case 'index.php?page=about': $title = 'About Us'; break; case 'index.php?page=quote': $title = 'Request A Quote'; break; case 'index.php?page=terms': $title = 'Terms of Use'; break; } echo ''.$title.''; ?>[/php]
I appreciate any help.