I’m trying to ASSIGN dynamically exclusive meta-tags for each page:
i.e:
url.com/index.php?action=signup
Header – Signup Title
Keywords – Signup Meta Keywords
Description – Signup Description
url.com/index.php?action=about
Header – About Title
Keywords – About Meta Keywords
Description – About Description
You got the point.
I’m using arrays…but didn’t figured yet HOW TO ASSIGN each array to each page.
CONF.PHP
<?php
$metas = array(
'index.php' => array(
'header' => 'Home Title',
'keywords' => 'Home Meta Keywords',
'description' => 'Home Meta Description'
),
'signup' => array(
'header' => 'Signup Title',
'keywords' => 'Signup Meta Keywords',
'description' => 'Signup Meta Description'
),
'about' => array(
'header' => 'About Title',
'keywords' => 'About Meta Keywords',
'description' => 'About Meta Description'
)
);
?>
INDEX.PHP
<TITLE><?php echo $metas['title']; ?></TITLE>
<meta name="description" content="<?php echo $metas['description']; ?>" >
<meta name="keywords" content="<?php echo $metas['keywords']; ?>" >
How to ASSIGN those values to each page???
You are on the right track 🙂
Do it in following way:
Script name you can get it from the $_SERVER super global array/variable.
Also from your config.php file remove last 3 lines, you don’t need them.
Good luck, with PHP make sure you get good knowledge about playing with array. That’s key.
EDIT:
EDIT: (on 27th May 2012)
I think this is pretty much everything:
Your code in config.php
Your code in any of your application page/screen (.php files):