Meta Tags For Individual Pages
I currently have a website based off a PHP template so all pages use the same header.php file via PHP's include.
I am just getting myself into meta data, etc. and wanted t开发者_运维百科o know how I go about having specific meta data for each individual page if each page is using the same header?
This is highly dependent on templating system you use. f.i. Zend Framework Zend_View enables you with view helpers for such tasks. If relying on something far less advanced as simple include "header.php", then you can specify a variable before including header file and set it with desired value, while in included file echo that variable.
Something like this:
index.php
<?php
//...
$meta_tags = '<meta content="Some description" http-equiv="description" />....';
include 'header.php':
//...
?>
header.php
...
<link type="text/css" href="style.css" rel="stylesheet">
<?php echo $meta_tags ?>
...
精彩评论