G
G
Good Samaritan2018-10-26 14:11:51
1C-Bitrix
Good Samaritan, 2018-10-26 14:11:51

How to change title in browser window?

in the news.detail template I write

<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?
$APPLICATION->SetPageProperty("title", "hi");

the old header is still displayed, what's the matter?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2018-10-26
@djamali

A popular mistake is that deferred functions are called in the component template: $APPLICATION->SetTitle(), $APPLICATION->AddChainItem(), etc. In this case, they only work when caching is disabled.
You need to do this
in result_modifier.php

$arResult["CUSTOM_TITLE"] = $arResult["NAME"]; //Тут формируйте свой заголовок

$cp = $this->__component; 
if (is_object($cp)) {
    $cp->SetResultCacheKeys(array(
        "CUSTOM_TITLE",
    ));
}

in component_epilog.php
In order not to make such mistakes, read about the component caching mechanism.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question