code/template/engine/abstract.php
public function renderPartial($url, array $data = array())
    {
        //Qualify relative template url
        if(!parse_url($url, PHP_URL_SCHEME))
        {
            if(!$template = end($this->__stack)) {
                throw new \RuntimeException('Cannot qualify partial template url');
            }

            $basepath = dirname($template);

            //Resolve relative path
            if($path = trim('.', dirname($url)))
            {
                $count = 0;
                $total = count(explode('/', $path));

                while ($count++ < $total) {
                    $basepath = dirname($basepath);
                }

                $basename = $url;
            }
            else $basename = basename($url);

            $url = $basepath. '/' .$basename;
        }

        if(array_search($url, $this->__stack))
        {
            throw new \RuntimeException(sprintf(
                'Template recursion detected while importing "%s" in "%s"', $url
            ));
        }

        $type = pathinfo( $this->locateSource($url), PATHINFO_EXTENSION);
        $data = array_merge((array) $this->getData(), $data);

        //If the partial requires a different engine create it and delegate
        if(!in_array($type, $this->getFileTypes()))
        {
            $result = $this->getObject('template.engine.factory')
                ->createEngine($type, array('functions' => $this->getFunctions()))
                ->render($url, $data);
        }
        else $result = $this->render($url, $data);

        //Remove the template from the stack
        array_pop($this->__stack);

        return $result;
    }
public function renderPartial($url, array $data = array())
    {
        //Qualify relative template url
        if(!parse_url($url, PHP_URL_SCHEME))
        {
            if(!$template = end($this->__stack)) {
                throw new \RuntimeException('Cannot qualify partial template url');
            }

            $basepath = dirname($template);

            //Resolve relative path
            if($path = trim('.', dirname($url)))
            {
                $count = 0;
                $total = count(explode('/', $path));

                while ($count++ < $total) {
                    $basepath = dirname($basepath);
                }

                $basename = $url;
            }
            else $basename = basename($url);

            $url = $basepath. '/' .$basename;
        }

        if(array_search($url, $this->__stack))
        {
            throw new \RuntimeException(sprintf(
                'Template recursion detected while importing "%s" in "%s"', $url
            ));
        }

        $type = pathinfo( $this->locateSource($url), PATHINFO_EXTENSION);
        $data = array_merge((array) $this->getData(), $data);

        //If the partial requires a different engine create it and delegate
        if(!in_array($type, $this->getFileTypes()))
        {
            $result = $this->getObject('template.engine.factory')
                ->createEngine($type, array('functions' => $this->getFunctions()))
                ->render($url, $data);
        }
        else $result = $this->render($url, $data);

        //Remove the template from the stack
        array_pop($this->__stack);

        return $result;
    }
public function renderPartial ( $ url , array $ data = array ( ) ) { //Qualify relative template url if ( ! parse_url ( $ url , PHP_URL_SCHEME ) ) { if ( ! $ template = end ( $ this -> __stack ) ) { throw new \ RuntimeException ( 'Cannot qualify partial template url' ) ; } $ basepath = dirname ( $ template ) ; //Resolve relative path if ( $ path = trim ( '.' , dirname ( $ url ) ) ) { $ count = 0 ; $ total = count ( explode ( '/' , $ path ) ) ; while ( $ count ++ < $ total ) { $ basepath = dirname ( $ basepath ) ; } $ basename = $ url ; } else $ basename = basename ( $ url ) ; $ url = $ basepath . '/' . $ basename ; } if ( array_search ( $ url , $ this -> __stack ) ) { throw new \ RuntimeException ( sprintf ( 'Template recursion detected while importing "%s" in "%s"' , $ url ) ) ; } $ type = pathinfo ( $ this -> locateSource ( $ url ) , PATHINFO_EXTENSION ) ; $ data = array_merge ( ( array ) $ this -> getData ( ) , $ data ) ; //If the partial requires a different engine create it and delegate if ( ! in_array ( $ type , $ this -> getFileTypes ( ) ) ) { $ result = $ this -> getObject ( 'template.engine.factory' ) -> createEngine ( $ type , array ( 'functions' => $ this -> getFunctions ( ) ) ) -> render ( $ url , $ data ) ; } else $ result = $ this -> render ( $ url , $ data ) ; //Remove the template from the stack array_pop ( $ this -> __stack ) ; return $ result ; }
Render a partial template

This method merges the data passed in with the data from the parent template. If the partial template
has different file type the method will try to allocate it by jumping out of the local template scope.

@param   string  $url      The template url
@param   array   $data     The data to pass to the template
@throws \RuntimeException  If a partial template url could not be fully qualified
@return  string The rendered template content
Render a partial template