public function inherit()
{
$strBuffer = '';
// Start with the template itself
$this->strParent = $this->strTemplate;
// Include the parent templates
while ($this->strParent !== null) {
$strCurrent = $this->strParent;
$strParent = $this->strDefault ?: $this->getTemplatePath($this->strParent, $this->strFormat);
// Reset the flags
$this->strParent = null;
$this->strDefault = null;
ob_start();
include $strParent;
// Capture the output of the root template
if ($this->strParent === null) {
$strBuffer = ob_get_contents();
} elseif ($this->strParent == $strCurrent) {
$this->strDefault = $this->getTemplatePath($this->strParent, $this->strFormat, true);
}
ob_end_clean();
}
// Reset the internal arrays
$this->arrBlocks = array();
// Add start and end markers in debug mode
if (\Config::get('debugMode')) {
$strRelPath = str_replace(TL_ROOT . '/', '', $this->getTemplatePath($this->strTemplate, $this->strFormat));
$strBuffer = "\n<!-- TEMPLATE START: {$strRelPath} -->\n{$strBuffer}\n<!-- TEMPLATE END: {$strRelPath} -->\n";
}
return $strBuffer;
}