- 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($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']);