Hi all I have a website that runs on PHP. In the title tags in the header I have: <title>Website.com - Tagline for site - Variable</title> This is great for the home page, but for inner pages I just wouldn't mind it saying: <title>Website.com - Variable</title> So my question is: Is there some code (maybe an if statement?) that I can use so that on the homepage it will use one set of title tags, and on other pages it will use another set of title tags? Cheers!
You could set a var on the index page to true. Then check the status of the var and if it is true then display the tagline. Does that help?
This code checks if requested page is homepage if ($_SERVER['REQUEST_URI']!="/") { // here you can assign necessary title } PHP: or if ($_SERVER['REQUEST_URI']!="/" || $_SERVER['REQUEST_URI']!="/index.html") { } PHP: If you have two addresses for homepage.
I'm not sure how you're coding your pages, but if you use one page for example index.php?page=index and then you have index.php?page=contact then the statement should be something like that: <?php switch($page) { case "index" : { $title="blah blah blah"; $description="double blah"; break; } case "contact" : { $title="contact blah blah"; $description="double contact blah"; break; } } ?> othewise you can just set $page=$_SERVER['REQUEST_URI']; and replace the conditions with the correct url Venetsian.