jteerman Posted January 14, 2010 Share Posted January 14, 2010 I'd like to modify my header.tpl file to modify the <title> and <meta description> tags based on the page they are accessing. I've added this to my file: {php} if ( $_SERVER["PHP_SELF"] = "/index.php" ) { $metatitle = "Home Page "; $metadescription = "This is the HOME meta description. "; } if ( $_SERVER["PHP_SELF"] = "/hosting.php" ) { $metatitle = "Hosting Plans Page"; $metadescription = "This is the HOMSTING PLANS meta description. "; } {/php} <title>{$companyname} - {$metatitle}</title> When the page displays, only the company name appears. Any help will be greatly appreciated! Jeff 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted January 14, 2010 Share Posted January 14, 2010 (edited) You can request them inside in a new PHP-tag: {php} if ( $_SERVER["PHP_SELF"] == "/index.php" ) { $metatitle = "Home Page "; $metadescription = "This is the HOME meta description. "; } if ( $_SERVER["PHP_SELF"] == "/hosting.php" ) { $metatitle = "Hosting Plans Page"; $metadescription = "This is the HOMSTING PLANS meta description. "; } {/php} <title>{$companyname} - {php}echo $metatitle;{/php}</title> Edited January 14, 2010 by m00 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted January 14, 2010 Share Posted January 14, 2010 {if $filename=="index"} {assign var="metatitle" value="Home Page "} {assign var="metadescription" value="This is the HOME meta description. "} {elseif $filename=="hosting"} {assign var="metatitle" value="Hosting Plans Page"} {assign var="metadescription" value="This is the HOMSTING PLANS meta description. "} {/if} <title>{$companyname} - {$metatitle}</title> <meta name="description" content="{$metadescription}"> 0 Quote Link to comment Share on other sites More sharing options...
jteerman Posted January 14, 2010 Author Share Posted January 14, 2010 {if $filename=="index"} {assign var="metatitle" value="Home Page "} {assign var="metadescription" value="This is the HOME meta description. "} {elseif $filename=="hosting"} {assign var="metatitle" value="Hosting Plans Page"} {assign var="metadescription" value="This is the HOMSTING PLANS meta description. "} {/if} <title>{$companyname} - {$metatitle}</title> <meta name="description" content="{$metadescription}"> Thanks Sparky! Jeff 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.