src/View/SSViewer.php
protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underlay, $inheritedScope = null)
    {
        if (isset($_GET['showtemplate']) && $_GET['showtemplate'] && Permission::check('ADMIN')) {
            $lines = file($cacheFile);
            echo "<h2>Template: $cacheFile</h2>";
            echo "<pre>";
            foreach ($lines as $num => $line) {
                echo str_pad($num+1, 5) . htmlentities($line, ENT_COMPAT, 'UTF-8');
            }
            echo "</pre>";
        }

        $cache = $this->getPartialCacheStore();
        $scope = new SSViewer_DataPresenter($item, $overlay, $underlay, $inheritedScope);
        $val = '';

        // Placeholder for values exposed to $cacheFile
        [$cache, $scope, $val];
        include($cacheFile);

        return $val;
    }
protected function includeGeneratedTemplate($cacheFile, $item, $overlay, $underlay, $inheritedScope = null)
    {
        if (isset($_GET['showtemplate']) && $_GET['showtemplate'] && Permission::check('ADMIN')) {
            $lines = file($cacheFile);
            echo "<h2>Template: $cacheFile</h2>";
            echo "<pre>";
            foreach ($lines as $num => $line) {
                echo str_pad($num+1, 5) . htmlentities($line, ENT_COMPAT, 'UTF-8');
            }
            echo "</pre>";
        }

        $cache = $this->getPartialCacheStore();
        $scope = new SSViewer_DataPresenter($item, $overlay, $underlay, $inheritedScope);
        $val = '';

        // Placeholder for values exposed to $cacheFile
        [$cache, $scope, $val];
        include($cacheFile);

        return $val;
    }
protected function includeGeneratedTemplate ( $ cacheFile , $ item , $ overlay , $ underlay , $ inheritedScope = null ) { if ( isset ( $ _GET [ 'showtemplate' ] ) && $ _GET [ 'showtemplate' ] && Permission :: check ( 'ADMIN' ) ) { $ lines = file ( $ cacheFile ) ; echo "<h2>Template: $cacheFile</h2>" ; echo "<pre>" ; foreach ( $ lines as $ num => $ line ) { echo str_pad ( $ num + 1 , 5 ) . htmlentities ( $ line , ENT_COMPAT , 'UTF-8' ) ; } echo "</pre>" ; } $ cache = $ this -> getPartialCacheStore ( ) ; $ scope = new SSViewer_DataPresenter ( $ item , $ overlay , $ underlay , $ inheritedScope ) ; $ val = '' ; // Placeholder for values exposed to $cacheFile [ $ cache , $ scope , $ val ] ; include ( $ cacheFile ) ; return $ val ; }
An internal utility function to set up variables in preparation for including a compiled
template, then do the include

Effectively this is the common code that both SSViewer#process and SSViewer_FromString#process call

@param string $cacheFile The path to the file that contains the template compiled to PHP
@param ViewableData $item The item to use as the root scope for the template
@param array $overlay Any variables to layer on top of the scope
@param array $underlay Any variables to layer underneath the scope
@param ViewableData $inheritedScope The current scope of a parent template including a sub-template
@return string The result of executing the template
An internal utility function to set up variables in preparation for including a compiled template then do the include