예제 #1
0
파일: Hamle.php 프로젝트: cseufert/hamle
 /**
  * Produce HTML Output from hamle Template file
  * @return string HTML Output as String
  * @throws Exception
  */
 function output()
 {
     try {
         ob_start();
         Run::addInstance($this);
         $baseModel = $this->baseModel;
         $this->baseModel = null;
         $currentModel = $baseModel == Scope::getTopScope();
         if (!$currentModel && $baseModel) {
             Scope::add($baseModel);
         }
         require $this->cacheFile;
         if (!$currentModel && $baseModel) {
             Scope::done();
         }
         $this->baseModel = $baseModel;
         $out = ob_get_contents();
         ob_end_clean();
     } catch (\Exception $e) {
         ob_end_clean();
         throw $e;
     }
     Run::popInstance();
     return $out;
 }