public function render($template, array $vars = array())
    {
        // Make sure template file isn't empty string
        if (empty($template)) {
            throw new LogicException('Empty template name provided');
        }

        if (!$this->templateExists($template)) {
            $base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $this->module, $this->theme);
            throw new RuntimeException(sprintf('Cannot find "%s.%s" in %s', $template, self::TEMPLATE_PARAM_EXTENSION, $base));
        }

        // Template file
        $file = $this->createInclusionPath($template);

        $this->addVariables($vars);

        if ($this->hasLayout()) {
            $layout = $this->createInclusionPath($this->layout, $this->layoutModule);

            $content = $this->createContentWithLayout($layout, $file);
        } else {
            $content = $this->createFileContent($file);
        }

        // Compress if needed
        if ($this->compress === true) {
            $compressor = new HtmlCompressor();
            $content = $compressor->compress($content);
        }

        return $content;
    }
public function render($template, array $vars = array())
    {
        // Make sure template file isn't empty string
        if (empty($template)) {
            throw new LogicException('Empty template name provided');
        }

        if (!$this->templateExists($template)) {
            $base = $this->createPath(self::TEMPLATE_PARAM_BASE_DIR, dirname($this->moduleDir), $this->module, $this->theme);
            throw new RuntimeException(sprintf('Cannot find "%s.%s" in %s', $template, self::TEMPLATE_PARAM_EXTENSION, $base));
        }

        // Template file
        $file = $this->createInclusionPath($template);

        $this->addVariables($vars);

        if ($this->hasLayout()) {
            $layout = $this->createInclusionPath($this->layout, $this->layoutModule);

            $content = $this->createContentWithLayout($layout, $file);
        } else {
            $content = $this->createFileContent($file);
        }

        // Compress if needed
        if ($this->compress === true) {
            $compressor = new HtmlCompressor();
            $content = $compressor->compress($content);
        }

        return $content;
    }
public function render ( $ template , array $ vars = array ( ) ) { // Make sure template file isn't empty string if ( empty ( $ template ) ) { throw new LogicException ( 'Empty template name provided' ) ; } if ( ! $ this -> templateExists ( $ template ) ) { $ base = $ this -> createPath ( self :: TEMPLATE_PARAM_BASE_DIR , dirname ( $ this -> moduleDir ) , $ this -> module , $ this -> theme ) ; throw new RuntimeException ( sprintf ( 'Cannot find "%s.%s" in %s' , $ template , self :: TEMPLATE_PARAM_EXTENSION , $ base ) ) ; } // Template file $ file = $ this -> createInclusionPath ( $ template ) ; $ this -> addVariables ( $ vars ) ; if ( $ this -> hasLayout ( ) ) { $ layout = $ this -> createInclusionPath ( $ this -> layout , $ this -> layoutModule ) ; $ content = $ this -> createContentWithLayout ( $ layout , $ file ) ; } else { $ content = $ this -> createFileContent ( $ file ) ; } // Compress if needed if ( $ this -> compress === true ) { $ compressor = new HtmlCompressor ( ) ; $ content = $ compressor -> compress ( $ content ) ; } return $ content ; }
Passes variables and renders a template. If there's attached layout, then renders it with that layout

@param string $template Template's name without extension in themes directory
@param array $vars
@throws \RuntimeException if wrong template file provided
@throws \LogicException If empty template name provided
@return string
Passes variables and renders a template . If there s attached layout then renders it with that layout