/**
  * @param string                  $file
  * @param Piece_Unity_ViewElement $viewElement
  */
 public static function render($file, Piece_Unity_ViewElement $viewElement)
 {
     $rendering = new Piece_Unity_Service_Rendering_PHP();
     ob_start();
     $rendering->render($file, $viewElement);
     $html = ob_get_contents();
     ob_end_clean();
     if (!headers_sent()) {
         Stagehand_HTTP_Status::send(500);
         header('Content-Type: text/html; charset=UTF-8');
     }
     echo $html;
 }
예제 #2
0
파일: PHP.php 프로젝트: piece/piece-unity
 /**
  * Renders a HTML.
  *
  * @param boolean $isLayout
  */
 protected function doRender($isLayout)
 {
     $templateDirectory = $this->templateDirectory;
     if (!$isLayout) {
         $view = $this->context->getView();
     } else {
         if (!is_null($this->layoutDirectory)) {
             $templateDirectory = $this->layoutDirectory;
         }
         $view = $this->layoutView;
     }
     if (is_null($templateDirectory)) {
         return;
     }
     $rendering = new Piece_Unity_Service_Rendering_PHP();
     $rendering->render($templateDirectory . '/' . str_replace('_', '/', str_replace('.', '', $view)) . $this->templateExtension, $this->context->viewElement);
 }