See the template articles
http://www.phpbuilder.com/columns/index.php3?cat=3&subcat=35
which can set you up with a template like you want in 5 mins.
Or you can do what i did, which is write on yesturday 😛
Here's what i did, you might find it useful...
function load_template($file) {
$tpl_file="$tpl_dir".$file;
if(!file_exists($tpl_file)) print"Loading template failed!";
$result = file_get_contents($file);
return $result;
}
Just simply run $template = load_template(filename) and it will return as the html file in $template
You may need to edit the $tpl_file settings
then:
function tpl_replace($data, $template) {
$search = array_keys ($data);
$replace = array_values ($data);
$template = str_replace ($search, $replace, $template);
return $template;
}
simply set what you want to replace with what variable:
$data = array (
"{IMG_TITLE}" => "$cat",
"{CONTENT}" => "$content",
"{PAGE_TITLE}" => "$page_title",
"{INDEX_LINK}" => "$index_link",
"{NEWS_LINK}" => "$news_link",
"{SITES_LINK}" => "$sites_link",
"{FORUMS_LINK}" => "$forums_link",
"{ABOUT_LINK}" => "$about_link",
"{SERVICES_LINK}" => "$services_link",
);
then run the function in the forum: $template = replace_tpl($data, $template);
then just echo it.
the functions will need to be inserted at the start of the page, you can use them afterwards like normal functions