core-bundle/src/Resources/contao/library/Contao/TemplateInheritance.php
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();
			$this->intBufferLevel = 1;

			try
			{
				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);
				}
			}
			finally
			{
				for ($i=0; $i<$this->intBufferLevel; $i++)
				{
					ob_end_clean();
				}
			}
		}

		// Reset the internal arrays
		$this->arrBlocks = array();

		// Add start and end markers in debug mode
		if (Config::get('debugMode'))
		{
			$strRelPath = StringUtil::stripRootDir($this->getTemplatePath($this->strTemplate, $this->strFormat));
			$strBuffer = "\n<!-- TEMPLATE START: $strRelPath -->\n$strBuffer\n<!-- TEMPLATE END: $strRelPath -->\n";
		}

		return $strBuffer;
	}
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();
			$this->intBufferLevel = 1;

			try
			{
				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);
				}
			}
			finally
			{
				for ($i=0; $i<$this->intBufferLevel; $i++)
				{
					ob_end_clean();
				}
			}
		}

		// Reset the internal arrays
		$this->arrBlocks = array();

		// Add start and end markers in debug mode
		if (Config::get('debugMode'))
		{
			$strRelPath = StringUtil::stripRootDir($this->getTemplatePath($this->strTemplate, $this->strFormat));
			$strBuffer = "\n<!-- TEMPLATE START: $strRelPath -->\n$strBuffer\n<!-- TEMPLATE END: $strRelPath -->\n";
		}

		return $strBuffer;
	}
Parse the template file and return it as string

@return string The template markup