Posted by Geoff Berrow on 05/04/07 09:11
Message-ID: <pjpl33l070pu143dotrmouf0r0t9858ms5@4ax.com> from tochiro
contained the following:
>I would like to have different meta tags for each page. What it the
>most effective method to do that without access to a data base?
Serve up different meta tags from an array of meta tags depending on the
page.
First setup an array containing the various different header info
<?php
$meta['index.php']="index meta tags go here";
$meta['page1.php']="page1 meta tags go here";
$meta['page2.php']="page2 meta tags go here";
....
//Then get the file name of the page that is including the headers
$parts=explode("/",$_SERVER['PHP_SELF']);
$file=$parts[(count($parts)-1)];
//Then simply echo the appropriate array element
echo $meta[$file];
?>
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
[Back to original message]
|