R
R
Ruslan Saifullin2015-11-12 23:51:41
1C-Bitrix
Ruslan Saifullin, 2015-11-12 23:51:41

When a component is cached, do SetAdditionalCSS and AddHeadScript fail in the component's template?

I was making a component and ran into this problem:
without the cache, the component correctly includes styles from the template (template.php):

<?
$APPLICATION->SetAdditionalCSS($componentPath."/js/jquery.bxslider/jquery.bxslider.css");
$APPLICATION->SetAdditionalCSS($componentPath."/style.css");
$APPLICATION->AddHeadScript($componentPath.'/js/jquery.bxslider/jquery.bxslider.min.js');
?>

But when this case is cached, it doesn't work.
Component code(componenet.php):
//....
// проверка параметров
//....
if($this->StartResultCache()){
  // код CIBlockElement :: GetList ();
        //....
  $this->SetResultCacheKeys(array("SLIDES"));
  $this->IncludeComponentTemplate();
}

ps in the site template is installed
<?$APPLICATION->ShowHead();?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-11-13
@Shapito27

Connection cannot be done in component.php?
Well, or take it out in component_epilog.php if you need to depend on the template
style.css if it is in the folder with the template, automatically connects

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question