hey guys,
I’m super rusty on php, so please forgive my retardation..
I’m using this script:
This is a very simple PHP snippet that will set $title, $meta_keywords and $meta_description for use in your page header. You’ll need to create meta_tags.txt which will use this format: page_name.html|page title|meta tags|meta description To use the code either save it at the top of your header file or save it as get_meta.php and add this line of code to your header: <?php include(‘get_meta.php’); ?> You can reference the $title, $meta_keywords and $meta_description variables in your header like this:
<title><?php print $title; ?></title> |
<?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]; } } ?>
my problem is that I still can’t get it to work for any pages within subdirs; it only works for pages in the root dir
little help?
negative on both
this has to do w/ some f’ed up pathing, huh…
nah, the setup is..
In root:
index.php -> has the reference to header.php in it
meta_tags.txt
In /includes/:
header.php –> has the reference to get_meta.php in it
get_meta.php
and the page that wont display meta is:
/features/index.php