public function loadAnyTemplate($uri = '', $forceParams = array(), $callback = null)
{
if (isset($this->viewTemplateAliases[$uri])) {
$uri = $this->viewTemplateAliases[$uri];
}
$layoutTemplate = $this->getLayoutTemplate();
$extraPaths = array();
if (!empty($this->templatePaths)) {
$extraPaths = $this->templatePaths;
}
// First get the raw view template path
$path = $this->viewFinder->resolveUriToPath($uri, $layoutTemplate, $extraPaths);
// Now get the parsed view template path
$this->_tempFilePath = $this->getEngine($path)->get($path, $forceParams);
// We will keep track of the amount of views being rendered so we can flush
// the section after the complete rendering operation is done. This will
// clear out the sections for any separate views that may be rendered.
$this->incrementRender();
// Get the evaluated template
$contents = $this->evaluateTemplate($forceParams);
// Once we've finished rendering the view, we'll decrement the render count
// so that each sections get flushed out next time a view is created and
// no old sections are staying around in the memory of an environment.
$this->decrementRender();
$response = isset($callback) ? $callback($this, $contents) : null;
if (!is_null($response)) {
$contents = $response;
}
// Once we have the contents of the view, we will flush the sections if we are
// done rendering all views so that there is nothing left hanging over when
// another view gets rendered in the future by the application developer.
$this->flushSectionsIfDoneRendering();
return $contents;
}