- 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);
+ # Check for $GLOBALS['wfpl_template'] because it might have been set (or unset) by the php script.
+ if($GLOBALS['wfpl_template'] || $GLOBALS['wfpl_main_template']) {
+ if($GLOBALS['wfpl_main_template']) {
+ # if there was a template for that page, and one for the whole
+ # site, copy all template sections that have been show()n to the
+ # site-wide template
+ if($GLOBALS['wfpl_template']) {
+ $GLOBALS['wfpl_main_template']->merge($GLOBALS['wfpl_template']);
+ }
+
+ $GLOBALS['wfpl_template'] = $GLOBALS['wfpl_main_template'];