302 if($site_template_id <>
'')
304 $result = \CSiteTemplate::GetByID($site_template_id);
305 if($templateFields = $result->Fetch())
307 $this->themePath = $templateFields[
'PATH'];
308 $template_path_header = \Bitrix\Main\Application::getDocumentRoot().$templateFields[
'PATH'].
'/header.php';
309 $template_path_footer = \Bitrix\Main\Application::getDocumentRoot().$templateFields[
'PATH'].
'/footer.php';
310 if($templateFields[
'PATH']!=
'' &&
IO\File::isFileExists($template_path_footer) &&
IO\File::isFileExists($template_path_header))
312 $this->themeStylesString .= $templateFields[
'TEMPLATE_STYLES'].
"\r\n";
313 $this->themeStylesString .= $templateFields[
'STYLES'].
"\r\n";
354 $resultThemeProlog =
'';
355 $resultThemeEpilog =
'';
357 if(!$this->themeProlog && $this->contentTypeHtml)
358 $this->body =
'<?=$this->showStyles()?>' .
$this->body;
360 $resultBody = $this->
executePhp($this->body, 100);
361 if($this->themeProlog)
364 $resultThemeProlog = $this->
executePhp($this->themeProlog, 50);
367 if($this->themeEpilog)
370 $resultThemeEpilog = $this->
executePhp($this->themeEpilog, 150);
373 $this->resultString = $resultThemeProlog . $resultBody . $resultThemeEpilog;
406 $arReplaceIdentificators = array();
407 $arReplaceStrings = array();
408 foreach($this->replaceCallback as $identificator => $callback)
410 $result = call_user_func_array($callback, array());
411 if($result ===
false)
414 $arReplaceIdentificators[] = $identificator;
415 $arReplaceStrings[] = $result;
418 $this->resultString = str_replace($arReplaceIdentificators, $arReplaceStrings, $this->resultString);
426 public static function includeComponent($componentName, $componentTemplate, $arParams = array(), $parentComponent =
null, $arFunctionParams = array())
428 $componentRelativePath = \CComponentEngine::MakeComponentPath($componentName);
429 if ($componentRelativePath ==
'')
432 if (is_object($parentComponent))
434 if (!($parentComponent instanceof \cbitrixcomponent))
435 $parentComponent =
null;
439 $bComponentEnabled = (!isset($arFunctionParams[
"ACTIVE_COMPONENT"]) || $arFunctionParams[
"ACTIVE_COMPONENT"] <>
"N");
441 $component = new \CBitrixComponent();
442 if($component->InitComponent($componentName))
445 if($bComponentEnabled)
447 $component->setSiteId(static::getInstance()->
getSiteId());
448 $component->setLanguageId(static::getInstance()->
getLanguageId());
453 $result = $component->IncludeComponent($componentTemplate, $arParams, $parentComponent);
457 $component->AbortResultCache();
461 $arThemeCss = array();
462 foreach($arThemeCss as $cssPath)
463 static::getInstance()->setStyle($cssPath);