- # Check for $GLOBALS['wfpl_template'] because it might have been set (or unset) by the php script.
- if($GLOBALS['wfpl_template']) {
- if(file_exists('template.html')) {
- $tem = new tem();
- $tem->load("template.html");
- $tem->set('basename', $basename);
- if($cms_content) foreach($cms_content as $name => $val) {
- $tem->append($name, $val);
- }
- $sections = tem_top_subs();
- if($sections) foreach($sections as $name => $val) {
- $tem->append($name, $val);
- }
-
- if(file_exists("$basename.css")) {
- $tem->set('css_link', "$basename.css");
- $tem->sub('css_links');
- }
-
- $GLOBALS['wfpl_template'] = $tem;
- }
-
- if(function_exists('display_messages')) {
- display_messages();
+ if(file_exists("template.html")) {
+ $template = parse_template_file("template.html");
+ if($html_exists) {
+ $subs = parse_template_file($html_file);
+ $template = merge_templates($template, $subs);