Dynamic Title and Meta Tags
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; ?>">
Tagged with: dynamic • meta tags • title • without database
Filed under: Allgemein • SEO Tips
Like this post? Subscribe to my RSS feed and get loads more!









Leave a Reply