Example #1
0
 function build($data, $page = false, $type = false, $assets = array())
 {
     $this->load->model('database');
     /* 
      * select a theme to use, if we're on a specific page that requires
      * a particular theme, enter it here, otherwise the user selected theme
      * is used. If no user selected theme is found, use the default
      */
     // get theme from db
     $get_theme = Database::get_config('theme');
     if (($theme = $get_theme) === false) {
         // if no theme found, use the default
         $theme = 'heat_default';
     }
     $css = NULL;
     $js = NULL;
     // add on the requested files from the $assets array
     if (!empty($assets)) {
         foreach ($assets as $type => $key) {
             foreach ($key as $key => $val) {
                 if (empty(${$type})) {
                     ${$type} = false;
                 }
                 ${$type} .= $val . ",";
             }
             // snip the last ampersand off
             ${$type} = substr(${$type}, 0, strlen(${$type}) - 1);
         }
     }
     // check to see if the page exists in the database, if so, turn it into a page
     // $query = $this->db->query("SELECT `id` FROM `heat_content` WHERE '" . @$data['id'] . "'=`id`");
     // if ($query->num_rows() != 0) {
     if (!empty($data['from_db'])) {
         $output = $this->load->view('compile', $data, true);
         $this->output->set_output($output);
     } else {
         if (!empty($page)) {
             $data['content'] = $this->load->view($page, $data, true);
         }
         $data['path'] = str_replace('/', '-', uri_string());
         $output = $this->load->view('compile', $data, true);
         $this->output->set_output($output);
     }
 }