- $data = &$GLOBALS['wfpl_tem_data'];
- $data['basename'] = $basename;
- if(function_exists('display_messages')) {
- display_messages();
- }
- if($cms_content) foreach($cms_content as $name => $value) {
- $data[$name] .= $value;
- }
- if(file_exists("$basename.css")) {
- $data['css_link'] = "$basename.css";
- }
+ # 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'];
+ }