If you are making landing pages without a content management or blog system you can use this great php snippet to generate dynamic titles and meta tags in your files.

This solution is for text based work not for using a database.


First you need a textfile (meta_tags.txt) with this content:

pagename.php | Title| Meta-Tags | meta description
pagename2.php | title2 | Meta-Tags for page 2 | Meta-Description for page2

Then you need your get_meta.php file:

<?php
 
$database = 'meta_tags.txt';
$meta_db = fopen($database, 'r');
 
$page = $_SERVER['SCRIPT_NAME'];
$page = substr($page, 1);
 
while($data = fgetcsv($meta_db, 9000, '|'))
{
	if($data[0] == $page)
	{
                $title = $data[1];
		$meta_keywords = $data[2];
		$meta_description = $data[3];
	}
}
 
?>

This code must be placed in your landing page:

<?php include('get_meta.php'); ?>
 
 
<title><?php print $title; ?></title>
<meta name="keywords" content="<?php print $meta_keywords; ?>">

Share and Enjoy: Diese Icons verlinken auf Bookmark Dienste bei denen Nutzer neue Inhalte finden und mit anderen teilen können.
  • MisterWong
  • Y!GG
  • Webnews
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • TwitThis

Tagged with:

Filed under: AllgemeinSEO Tips

Like this post? Subscribe to my RSS feed and get loads more!