Ejemplo n.º 1
0
 /**
  * This method is called when all types of request are received
  *
  * @return void
  * @author Ed Eliot
  **/
 protected function do_all()
 {
     $page = new HaploTemplate($this->config->get_key_or_default($this->section, 'layout', '_layout.php'));
     $page->set('section', $this->section);
     $page->set('title', $this->config->get_key_or_default($this->section, 'title'));
     $page->set('metaDesc', $this->config->get_key_or_default($this->section, 'metaDesc'));
     $page->set('metaKeywords', $this->config->get_key_or_default($this->section, 'metaKeywords'));
     $page->set('translations', $this->translations);
     $page->set('content', new HaploTemplate('page-not-found.php'));
     $page->display();
 }
Ejemplo n.º 2
0
 /**
  * This method is called when all types of request are received
  *
  * @return void
  * @author Ed Eliot
  **/
 protected function do_all()
 {
     if ($template = $this->router->get_request_var('template', 'home')) {
         $template = trim($template, '/');
         $this->section = $template;
         try {
             $page = new HaploTemplate($this->config->get_key_or_default($this->section, 'layout', '_layout.php'));
             $page->set('section', $this->section);
             $page->set('title', $this->config->get_key_or_default($this->section, 'metaTitle'));
             $page->set('metaDesc', $this->config->get_key_or_default($this->section, 'metaDesc'));
             $page->set('metaKeywords', $this->config->get_key_or_default($this->section, 'metaKeywords'));
             $page->set('translations', $this->translations);
             $page->set('content', new HaploTemplate($template . '.php'));
             $page->display();
         } catch (Exception $e) {
             $this->do_404();
         }
     } else {
         throw new HaploTemplateNotFoundException('Static page template not specified in ' . $this->router->get_action() . '.');
     }
 }