public function index($preso = "default", $mode = "") { $html = ""; if ($preso === "default") { $title = "Uglymongrel.com Presents: Various presentations by Alexander Schmitz"; } else { $title = $preso; } $follow = false; $master = false; if ($mode === "master") { $master = true; } else { if ($mode === "presenter") { $master = true; $this->presenter($preso); return; } else { if ($mode === "follow") { $follow = true; } } } $data = array("title" => $this->format_title($title), "master" => $master, "follow" => $follow); $htmlData = array("html" => $html, "options" => array()); $this->load->library("Minify_html", $htmlData); $min = new Minify_html($htmlData); $this->load->helper("directory", $data); $this->load->helper("presentation_tools"); $html .= $this->load->view('head', $data, true); $html .= "<body>"; $html .= $this->load->view('header', $data, true); $html .= $this->load->view('popup', $data, true); $html .= $this->load_slides($preso); $html .= $this->load->view('footer', $data, true); $html .= "</body></html>"; $htmlData = array("html" => $html, "options" => array()); echo $min->Minify($htmlData); }
/** * Build the entire HTML output combining partials, layouts and views. * * @access public * @param string * @return void */ public function build($view, $data = array(), $return = FALSE, $load_assets_url = null) { // Set whatever values are given. These will be available to all view files is_array($data) or $data = (array) $data; // Merge in what we already have with the specific data $this->_data = array_merge($this->_data, $data); // We don't need you any more buddy unset($data); if (empty($this->_title)) { $this->_title = $this->_guess_title(); } // Output template variables to the template $template['title'] = $this->_title; $template['breadcrumbs'] = $this->_breadcrumbs; $template['metadata'] = implode("\n\t\t", $this->_metadata); $template['partials'] = array(); // Assign by reference, as all loaded views will need access to partials $this->_data['template'] =& $template; foreach ($this->_partials as $name => $partial) { // We can only work with data arrays is_array($partial['data']) or $partial['data'] = (array) $partial['data']; // If it uses a view, load it if (isset($partial['view'])) { $template['partials'][$name] = $this->_find_view($partial['view'], $partial['data']); } else { if ($this->_parser_enabled === TRUE) { $partial['string'] = $this->_ci->parser->parse_string($partial['string'], $this->_data + $partial['data'], TRUE, TRUE); } $template['partials'][$name] = $partial['string']; } } // Disable sodding IE7's constant cacheing!! $this->_ci->output->set_header('Expires: Sat, 01 Jan 2000 00:00:01 GMT'); $this->_ci->output->set_header('Cache-Control: no-store, no-cache, must-revalidate'); $this->_ci->output->set_header('Cache-Control: post-check=0, pre-check=0, max-age=0'); $this->_ci->output->set_header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); $this->_ci->output->set_header('Pragma: no-cache'); // Let CI do the caching instead of the browser $this->_ci->output->cache($this->cache_lifetime); // Test to see if this file $this->_body = $this->_find_view($view, array(), $this->_parser_body_enabled); // Want this file wrapped with a layout file? if ($this->_layout) { // Added to $this->_data['template'] by refference $template['body'] = $this->_body; // Find the main body and 3rd param means parse if its a theme view (only if parser is enabled) $this->_body = self::_load_view($this->_layout, $this->_data, TRUE); } if (!empty($load_assets_url)) { $html =& $this->_ci->simple_html_dom; $html->load($this->_body); foreach ($html->find('script') as $e) { if (!empty($e->src)) { if (!filter_var($e->src, FILTER_VALIDATE_URL)) { $e->src = base_url($load_assets_url . '/' . $e->src); } } } foreach ($html->find('img') as $e) { if (!empty($e->src)) { if (!filter_var($e->src, FILTER_VALIDATE_URL)) { $e->src = base_url($load_assets_url . '/' . $e->src); } } } foreach ($html->find('link') as $e) { if (!empty($e->href)) { if ($e->rel == "stylesheet") { if (!filter_var($e->href, FILTER_VALIDATE_URL)) { $e->href = base_url($load_assets_url . '/' . $e->href); } } } } $this->_body = $html->save(); } $this->_body = Minify_html::minify($this->_body); // Want it returned or output to browser? if (!$return) { $this->_ci->output->set_output($this->_body); } return $this->_body; }