Re: dynamic meta tag and title app?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux