|
Posted by shimmyshack on 05/04/07 09:08
On May 4, 8:57 am, tochiro <nos...@nospam.com> wrote:
> Hello,
>
> I have a small website and I use the include function for the top head
> section of each page. This is convenient but all the pages have the
> same meta tags as a result.
>
> 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?
>
> I am a beginner.
>
> Thank you for your help.
you do have access to sqllite probably, but anyway
inside your header you might want to have an include('meta_tags.php');
statement.
this is a script that detects the page its on using
$_SERVER['REQUEST_URI'] or if each page is a query string, ?
page=page123 then it should detect the QS and find the page that way.
then you can have something like this:
----------------
<?php
$title = 'Website - ';
$descriptions = '';
$author = '';
#other perpage metatags go here
switch ($page)
{
case 'sales':
$keywords = 'sales, buy stuff';
$description = 'Our Friendly Sales Page';
$title .= 'Sales';
break;
case 'contact':
$keywords = 'contact us, email us, contact, get in touch';
$description = 'We are always happy to hear from you';
$title .= 'Contact Us';
$author = 'tochiro';
break;
..
..
..
$title = ($title=='Website - ') ? $title.'The Place To Be' :
ucwords($title);
$keywords = ($keywords=='') ? 'My Website, great website, buy stuff,
blah blah' : $keywords;
?>
<title><?php echo $title; ?></title>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<meta name="description" content="<?php echo $description; ?>" />
<?php if($author!='') echo "\n".'<meta name="author" content="'.
$author.'" />'."\n"; ?>
-----------------
its cheap and cheerful, but hey
Navigation:
[Reply to this message]
|