示例#1
0
文件: View.php 项目: mvccore/mvccore
 public function Render($typePath = 'Scripts', $relativePath = '')
 {
     $result = '';
     $appRoot = $this->Controller->GetRequest()->appRoot;
     $relativePath = $this->_correctRelativePath($appRoot, $typePath, $relativePath);
     $viewScriptFullPath = implode('/', array($appRoot, 'App', 'Views', $typePath, $relativePath . MvcCore_View::EXTENSION));
     if (!file_exists($viewScriptFullPath)) {
         throw new Exception("[MvcCore_View] Template not found in path: '{$viewScriptFullPath}'.");
     }
     $this->_renderedFullPaths[] = $viewScriptFullPath;
     ob_start();
     include $viewScriptFullPath;
     $result = ob_get_clean();
     array_pop($this->_renderedFullPaths);
     // unset last
     return $result;
 }