Пример #1
0
 public function render()
 {
     if ($this->package === NULL) {
         $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
         $class = $trace[0]['class'];
         preg_match('/([A-Za-z]*)\\\\([A-Za-z]*)/', $class, $match);
         $this->package = $match[1] . '.' . $match[2];
     }
     $replacements = array('@package' => $this->package, '@document' => $this->document);
     if ($this->templateSource === NULL) {
         $template = str_replace(array_keys($replacements), array_values($replacements), $this->templatePath);
         $this->view->setTemplatePathAndFilename($template);
         $layoutRootPath = str_replace(array_keys($replacements), array_values($replacements), $this->layoutRootPath);
         $this->view->setLayoutRootPath($layoutRootPath);
         $partialRootPath = str_replace(array_keys($replacements), array_values($replacements), $this->partialRootPath);
         $this->view->setPartialRootPath($partialRootPath);
     } else {
         $this->view->setTemplateSource($this->templateSource);
     }
     $this->view->setFormat('html');
     $this->view->getRequest()->setControllerPackageKey($this->package);
     $content = $this->view->render();
     return $content;
 }