• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/component_template.php
  • Класс: CBitrixComponentTemplate
  • Вызов: CBitrixComponentTemplate::__SearchTemplateFile
public function __SearchTemplateFile($path, $fileName)
{
	global $arBXRuntimeTemplateEngines;

	if (!$arBXRuntimeTemplateEngines)
		$this->InitTemplateEngines();

	$filePath = $_SERVER["DOCUMENT_ROOT"].$path."/".$fileName.".php";
	if (count($arBXRuntimeTemplateEngines) === 1 && file_exists($filePath) && is_file($filePath))
	{
		return $fileName.".php";
	}
	else
	{
		foreach ($arBXRuntimeTemplateEngines as $templateExt => $engineID)
		{
			$filePath = $_SERVER["DOCUMENT_ROOT"].$path."/".$fileName.".".$templateExt;
			if (file_exists($filePath) && is_file($filePath))
			{
				return $fileName.".".$templateExt;
			}
		}
	}

	return false;
}