/** * Find the XHTML template according to $this->templatePathAndFilenamePattern and render the template. * If "layoutName" is set in a PostParseFacet callback, it will render the file with the given layout. * * @param string $actionName If set, the view of the specified action will be rendered instead. Default is the action specified in the Request object * @return string Rendered Template * @author Sebastian Kurfürst <*****@*****.**> * @api */ public function render($actionName = NULL) { $templatePathAndFilename = $this->resolveTemplatePathAndFilename($actionName); $this->templateParser->setConfiguration($this->buildParserConfiguration()); $parsedTemplate = $this->parseTemplate($templatePathAndFilename); $variableContainer = $parsedTemplate->getVariableContainer(); if ($variableContainer !== NULL && $variableContainer->exists('layoutName')) { return $this->renderWithLayout($variableContainer->get('layoutName')); } return $parsedTemplate->render($this->buildRenderingContext()); }
/** * Loads the template source and render the template. * If "layoutName" is set in a PostParseFacet callback, it will render the file with the given layout. * * @param string $actionName If set, the view of the specified action will be rendered instead. Default is the action specified in the Request object * @return string Rendered Template * @author Sebastian Kurfürst <*****@*****.**> * @author Robert Lemke <*****@*****.**> * @api */ public function render($actionName = NULL) { $this->baseRenderingContext->setControllerContext($this->controllerContext); $this->templateParser->setConfiguration($this->buildParserConfiguration()); $parsedTemplate = $this->templateParser->parse($this->getTemplateSource($actionName)); if ($this->isLayoutDefinedInTemplate($parsedTemplate)) { $this->startRendering(self::RENDERING_LAYOUT, $parsedTemplate, $this->baseRenderingContext); $parsedLayout = $this->templateParser->parse($this->getLayoutSource($this->getLayoutNameInTemplate($parsedTemplate))); $output = $parsedLayout->render($this->baseRenderingContext); $this->stopRendering(); } else { $this->startRendering(self::RENDERING_TEMPLATE, $parsedTemplate, $this->baseRenderingContext); $output = $parsedTemplate->render($this->baseRenderingContext); $this->stopRendering(); } return $output; }