Ejemplo n.º 1
0
 /**
  * Send a rendered template file HTML message
  */
 public function sendTemplate($file = '', $data = array())
 {
     if (!empty($file) && is_file($file)) {
         $tpl_base = dirname($file);
         $tpl_file = '/' . basename($file);
         $view = new View();
         $view->setPlublicPath($tpl_base);
         $view->addRenderPath($tpl_base);
         $view->setTemplate($tpl_file);
         $view->set('url', Server::getUrl());
         $view->set('ip', Client::getIp());
         $view->set('browser', Client::getAgent());
         $view->set('date', date('l jS \\of F Y h:i A T'));
         return $this->sendHtml($view->render());
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * Renders a custom HTML template
  */
 private function _renderTemplate()
 {
     $base = dirname($this->_path_template);
     $file = basename($this->_path_template);
     $data = $this->_getOutputData(true);
     $data = $this->filterEvent('renderTemplate', $data);
     $view = new View();
     $view->setPlublicPath($base);
     $view->addRenderPath($base);
     $view->setTemplate('/' . $file);
     $view->setData($data);
     $response = new Response();
     $response->setHtml($this->_status_code, $view->render());
     $response->send();
     exit;
 }