コード例 #1
0
ファイル: mvc.php プロジェクト: OPL/Open-Power-Template
 public function display(Opt_Output_Interface $out, Opt_View $view)
 {
     $layout = new Opt_View('layout.tpl');
     $layout->websiteTitle = $this->config->get('website', 'title');
     $layout->view = $view;
     $out->render($layout);
 }
コード例 #2
0
ファイル: Class.php プロジェクト: OPL/Open-Power-Template
 /**
  * Executes, and optionally compiles the template represented by the view.
  * Returns true, if the template was found and successfully executed.
  *
  * @param Opt_Output_Interface $output The output interface.
  * @param Boolean $exception Should the exceptions be thrown if the template does not exist?
  * @return Boolean
  */
 public function _parse(Opt_Output_Interface $output, $exception = true)
 {
     if ($this->_tpl->debugConsole) {
         $time = microtime(true);
     }
     $cached = false;
     if ($this->_cache !== null) {
         $result = $this->_cache->templateCacheStart($this);
         if ($result !== false) {
             // For dynamic cache...
             if (is_string($result)) {
                 include $result;
             }
             return true;
         }
         $cached = true;
     }
     $this->_tf = $this->_tpl->getTranslationInterface();
     if ($this->_tpl->compileMode != Opt_Class::CM_PERFORMANCE) {
         list($compileName, $compileTime) = $this->_preprocess($exception);
         if ($compileName === null) {
             return false;
         }
     } else {
         $compileName = $this->_convert($this->_template);
         $compileTime = null;
         if (!$exception && !file_exists($compileName)) {
             return false;
         }
     }
     $old = error_reporting($this->_tpl->errorReporting);
     require $this->_tpl->compileDir . $compileName;
     error_reporting($old);
     // The counter stops, if the time counting has been enabled for the debug console purposes
     if ($this->_cache !== null) {
         $this->_cache->templateCacheStop($this);
     }
     if (isset($time)) {
         Opt_Support::addView($this->_template, $output->getName(), $this->_processingTime = microtime(true) - $time, $cached);
     }
     return true;
 }