Answer the question
In order to leave comments, you need to log in
How to correctly call deferred functions in a component template with caching enabled?
Hello!
There is a need to call a deferred function in the component template, for example, <?=$APPLICATION->ShowTitle()?>
.
However, if you enable caching, then the layout breaks.
Question: how to correctly call this function in the component template?
Thanks in advance!
Solution, thanks @alexyarik
Once above loop get the value and then work with it <?$getTitle=$APPLICATION->GetTitle()?> .
Answer the question
In order to leave comments, you need to log in
you get the value once above the loop and then work with it <?$getTitle=$APPLICATION->GetTitle()?>, otherwise you repeat the deferred function in the loop, which, in theory, should work once.
GetTitle() and GetProperty() are not deferred functions, i.e. if you override the title lower in the code than the GetTitle() call, then you will get the old title that was set higher in the code, or false if the title was not set before the GetTitle() call.
$title = $APPLICATION->GetProperty("title");
echo $title
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question