Aricus2021-11-19 14:32:14
Aricus, 2021-11-19 14:32:14

1s-bitrix: why are the headers from the component template not installed?

In the template.php of the component template, I try to set and get the title in two ways:

print_r($arResult['PREVIEW_TEXT'].' '.$arResult['NAME']); echo '<br>';
$APPLICATION->SetTitle($arResult['PREVIEW_TEXT'].' '.$arResult['NAME']);
$APPLICATION->SetPageProperty("title", $arResult['PREVIEW_TEXT'].' '.$arResult['NAME']);
$APPLICATION->ShowTitle(); echo '<br>';
$APPLICATION->ShowTitle(false); echo '<br>';

I get:
KNX digital input module, 24 channels UCS-24.00

Headings in h1 and browser tab also do not change.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
no_one_safe, 2021-11-19

1. Setting headers from the cached part is useless - the template will not be executed on the next hit .
2. Someone below in the code exposes other headers. Probably the component itself.
You need to set headers after calling the component.

Roman Morozov, 2021-11-23

Read that these are deferred functions in Bitrix

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question