R
R
Ruslan2019-05-20 19:49:27
1C-Bitrix
Ruslan, 2019-05-20 19:49:27

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

3 answer(s)
Y
Yaroslav Alexandrov, 2019-05-21
@ruslan_aleev

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.

K
karabash22, 2019-10-16
@karabash22

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.

K
Kirill Proger, 2019-05-20
@freekirill

$title = $APPLICATION->GetProperty("title");
echo $title

you can do that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question