Example #1
0
 public function renderMail($arquivo)
 {
     $arquivo = str_replace('_', '/', $arquivo);
     $module = ucfirst(Request::getModules() != NULL ? Request::getModules() : 'Front');
     if (!file_exists(VIEW_PATH . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . $arquivo . '.phtml')) {
         // Não existe, então lança uma exceção.
         $this->error("Houve um erro. Essa View {$arquivo} nao existe.");
     }
     if (!file_exists(LAYOUT_PATH . $this->layout . 'layout.phtml')) {
         // Não existe, então lança uma exceção.
         $this->error("Houve um erro. Esse layout  {$this->layout}layout.phtml nao existe.");
     }
     // Armazena o Layout e conteúde no buffer
     ob_start();
     include VIEW_PATH . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . $arquivo . '.phtml';
     return ob_get_clean();
 }