public function render($template, $view, $partials = null)
    {
        // Tokenize and alias partials
        $tokenizedPartials = [];
        if (null !== $partials) {
            if (! is_array($partials) && ! is_object($partials)) {
                throw new Exception\InvalidPartialsException();
            }

            // Get tokenized partials
            foreach ($partials as $alias => $partialTemplate) {
                if (! is_string($partialTemplate)) {
                    continue;
                }
                $tokenizedPartials[$alias] = $this->tokenize($partialTemplate);

                // Cache under this alias as well
                $this->cachedTemplates[$alias] = $tokenizedPartials[$alias];
            }
        }

        $tokens = $this->tokenize($template);

        $renderer = $this->getRenderer();
        return $renderer->render($tokens, $view, $tokenizedPartials);
    }
public function render($template, $view, $partials = null)
    {
        // Tokenize and alias partials
        $tokenizedPartials = [];
        if (null !== $partials) {
            if (! is_array($partials) && ! is_object($partials)) {
                throw new Exception\InvalidPartialsException();
            }

            // Get tokenized partials
            foreach ($partials as $alias => $partialTemplate) {
                if (! is_string($partialTemplate)) {
                    continue;
                }
                $tokenizedPartials[$alias] = $this->tokenize($partialTemplate);

                // Cache under this alias as well
                $this->cachedTemplates[$alias] = $tokenizedPartials[$alias];
            }
        }

        $tokens = $this->tokenize($template);

        $renderer = $this->getRenderer();
        return $renderer->render($tokens, $view, $tokenizedPartials);
    }
public function render ( $ template , $ view , $ partials = null ) { // Tokenize and alias partials $ tokenizedPartials = [ ] ; if ( null !== $ partials ) { if ( ! is_array ( $ partials ) && ! is_object ( $ partials ) ) { throw new Exception \ InvalidPartialsException ( ) ; } // Get tokenized partials foreach ( $ partials as $ alias => $ partialTemplate ) { if ( ! is_string ( $ partialTemplate ) ) { continue ; } $ tokenizedPartials [ $ alias ] = $ this -> tokenize ( $ partialTemplate ) ; // Cache under this alias as well $ this -> cachedTemplates [ $ alias ] = $ tokenizedPartials [ $ alias ] ; } } $ tokens = $ this -> tokenize ( $ template ) ; $ renderer = $ this -> getRenderer ( ) ; return $ renderer -> render ( $ tokens , $ view , $ tokenizedPartials ) ; }
Render a template using a view, and optionally a list of partials

@param  string $template Either a template string or a template file in the template path
@param  array|object $view An array or object with items to inject in the template
@param  array|object $partials A list of partial names/template pairs for rendering as partials
@return string
@throws Exception\InvalidPartialsException
Render a template using a view and optionally a list of partials