Re: dynamic meta tag and title app?

From: Date: Thu, 19 Nov 2009 01:19:40 +0000
Subject: Re: dynamic meta tag and title app?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-299920@lists.php.net to get a copy of this message
Jack S wrote: > Hello All, > > Does anyone have a reference to a program that may be out there to > help with using a single header.php for a site, but then dynamically > loads different keywords , titles etc based on what page is including > the header file? > > Sample: > If home page include it knows the title and other variables would be > home, about us would be about etc. > So if you have an index.php that is controlling your site and you use get params like page=home, then something like this in the header: switch ($_GET['page']) { case 'home': $title = 'Home'; $description = 'Some description'; $keywords = "some, key, words"; break; case 'about': $title = 'about'; $description = 'Some description'; $keywords = "some, key, words"; break; default $title = 'whatever'; $description = 'Some description'; $keywords = "some, key, words"; break; } include('header.php'); include('whatever_file.php'); If you have separate pages like home.php, then something like this: // home.php $title = 'Home'; $description = 'Some description'; $keywords = "some, key, words"; include('header.php'); //header.php // use the vars from the including file -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#299920) next »