in the process of creating a site which will require pages to be generated on the fly. to do this I am trying to set up a template file that I can include in all the pages to set common header/footer details. problem is, I can't get it to work.
here is the script (using an article on this site as a guideline):
<?php
function site_header($title) {
echo "";
echo "<HEAD>";
echo "<TITLE>Product Reviews -'.$title.'</TITLE>";
//set up metatags
//take out "the", "and" and "a"
//a truly gifted developer would use
//a great Regular Expression here
$keywords=str_replace("the ",'',strtolower($title));
$keywords=str_replace("a ",'',$keywords);
$keywords=str_replace("and ",'',$keywords);
$keywords=str_replace("\"",'',$keywords);
//make the string comma-separated
$meta_array=explode(' ',$keywords);
$meta_words=implode($meta_array,', ');
echo "<META NAME=\"KEYWORDS\" CONTENT=\"PHP, '.$meta_words.'\">";
echo "<META NAME=\"DESCRIPTION\" CONTENT=\"Product Reviews, '.$title.'\">";
echo "</HEAD>";
echo "<BODY TEXT=\"#000099\" BGCOLOR=\"#FFFFFF\">";
}
print "this is just a test of this function";
function site_footer() {
//contains common html
//for the footer
echo "</BODY>";
}
?>
then in the use:
include('./shared.inc');
to include this file in my pages.
(this also doesn't work if I tweak it and embed within a page)
when this page is called from the form with $title passed in the only thing that shows up is the print contents in the middle (this is just a test of this function). If I remove the '$title' definition in site_header still nothing.
1) I can't find any reference to site_header or site_footer in the docs, am I missing it (likely)?
2) Since I can't find in the docs, I am not sure what is the correct syntax and what my expectations should be for the output. as of now, nothing shows in the source except the middle print line.
Any/all help is greatly appreciated.
/frank