/** * display() * Outputs the HTML * * @access public */ public function display() { global $_DB, $_CONFIG, $_MESSAGES, $_SECTION, $_SUBSECTION; // Get the style used $style = $_CONFIG['thinker_view_html']['template']; $styleDir = "View/html/style/{$style}"; // Get the filename for the section's action template $tplFile = 'Section/' . $_SECTION . '/html/' . $_SUBSECTION . '.tpl'; $iniFile = 'Section/' . $_SECTION . '/config.ini'; // Ensure file exists if (!file_exists($tplFile) || !file_exists($iniFile)) { // Redirect to error errorRedirect(404); exit; } // Parse ini file $viewSettings = parse_ini_file($iniFile, true); // Start HTML output ?> <!DOCTYPE html> <html> <head> <?php // Include head items include_once $styleDir . "/head.inc"; ?> </head> <body> <?php // Include heading include_once $styleDir . "/bodyHeading.inc"; // Include body data include_once $tplFile; // Include footer include_once $styleDir . "/bodyFooter.inc"; ?> </body> </html> <?php }
} } // Attempt to load subsection if (method_exists($_SECTION_CLASS, $_SUBSECTION)) { // Call method $result = $instance->{$_SUBSECTION}(); } else { // Error redirect errorRedirect(404); } // Compile info array $_INFO['environment'] = $_CONFIG['thinker_general']['environment']; $_INFO['section'] = $_SECTION; $_INFO['subsection'] = $_SUBSECTION; if ($result) { // Create a view $view = THINKER_View::factory($instance->view, $instance); if ($view) { $view->display(); } else { trigger_error("Failed to generate the View.", E_USER_ERROR); } } else { trigger_error("Subsection did not load successfully.", E_USER_ERROR); } } else { // Error redirect errorRedirect(404); } // Close database connection $_DB = null;