- if(file_exists($html_file)) {
- require $html_file;
- } else {
- header('HTTP/1.0 404 File Not Found');
- if(file_exists('404.php') || file_exists('404.html')) {
- run_php('404');
- } else {
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>404</title></head><body><h1>404 File Not Found</h1></body></html>';
+ $sub_names = tem_top_sub_names();
+ foreach($sub_names as $sub_name) {
+ tem_sub($sub_name);
+ }
+ }
+
+ # 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");
+ 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');