public function render($realTemplateName, array $parameters = array(), $compressOutput = true)
    {
        if (false === $this->templateExists($realTemplateName) || false === $this->checkTemplate($realTemplateName)) {
            throw new ResourceNotFoundException(Translator::getInstance()->trans("Template file %file cannot be found.", array('%file' => $realTemplateName)));
        }

        // Prepare common template variables
        /** @var Session $session */
        $session = $this->getRequest()->getSession();

        $lang = $session ? $session->getLang() : Lang::getDefaultLanguage();

        $parameters = array_merge($parameters, [
            'locale' => $lang->getLocale(),
            'lang_code' => $lang->getCode(),
            'lang_id' => $lang->getId(),
            'current_url' => $this->getRequest()->getUri(),
            'app' => (object) [
                'environment' => $this->env,
                'request' => $this->getRequest(),
                'session' => $session,
                'debug' => $this->debug
            ]
        ]);

        return $this->internalRenderer('file', $realTemplateName, $parameters, $compressOutput);
    }
public function render($realTemplateName, array $parameters = array(), $compressOutput = true)
    {
        if (false === $this->templateExists($realTemplateName) || false === $this->checkTemplate($realTemplateName)) {
            throw new ResourceNotFoundException(Translator::getInstance()->trans("Template file %file cannot be found.", array('%file' => $realTemplateName)));
        }

        // Prepare common template variables
        /** @var Session $session */
        $session = $this->getRequest()->getSession();

        $lang = $session ? $session->getLang() : Lang::getDefaultLanguage();

        $parameters = array_merge($parameters, [
            'locale' => $lang->getLocale(),
            'lang_code' => $lang->getCode(),
            'lang_id' => $lang->getId(),
            'current_url' => $this->getRequest()->getUri(),
            'app' => (object) [
                'environment' => $this->env,
                'request' => $this->getRequest(),
                'session' => $session,
                'debug' => $this->debug
            ]
        ]);

        return $this->internalRenderer('file', $realTemplateName, $parameters, $compressOutput);
    }
public function render ( $ realTemplateName , array $ parameters = array ( ) , $ compressOutput = true ) { if ( false === $ this -> templateExists ( $ realTemplateName ) || false === $ this -> checkTemplate ( $ realTemplateName ) ) { throw new ResourceNotFoundException ( Translator :: getInstance ( ) -> trans ( "Template file %file cannot be found." , array ( '%file' => $ realTemplateName ) ) ) ; } // Prepare common template variables /** @var Session $session */ $ session = $ this -> getRequest ( ) -> getSession ( ) ; $ lang = $ session ? $ session -> getLang ( ) : Lang :: getDefaultLanguage ( ) ; $ parameters = array_merge ( $ parameters , [ 'locale' => $ lang -> getLocale ( ) , 'lang_code' => $ lang -> getCode ( ) , 'lang_id' => $ lang -> getId ( ) , 'current_url' => $ this -> getRequest ( ) -> getUri ( ) , 'app' => ( object ) [ 'environment' => $ this -> env , 'request' => $ this -> getRequest ( ) , 'session' => $ session , 'debug' => $ this -> debug ] ] ) ; return $ this -> internalRenderer ( 'file' , $ realTemplateName , $ parameters , $ compressOutput ) ; }
Return a rendered template file

@param  string                    $realTemplateName the template name (from the template directory)
@param  array                     $parameters       an associative array of names / value pairs
@return string                    the rendered template text
@param  bool                      $compressOutput   if true, te output is compressed using trimWhitespaces. If false, no compression occurs
@throws ResourceNotFoundException if the template cannot be found
@throws \Exception
@throws \SmartyException
Return a rendered template file