S
S
spy452422020-01-27 10:41:10
1C-Bitrix
spy45242, 2020-01-27 10:41:10

Meta tag substitution with buffered Bitrix content myth or reality?

The page has buffered content enabled.
When the page is loaded, the some.php file is connected in which the component and the whole kitchen are called.
If you use something like this on some event:
$APPLICATION->SetPageProperty("title", "some one else");
then it doesn't work because the properties of the page are overridden by the properties from the some.php file.
I found the only way out of the situation, at the OnEndBufferContent event (where all the page content falls into the $content variable) to replace a piece of content like this:
$content = preg_replace('/]+)>.*?<\/title>/m', ' some one else', $content);
But I don’t really like this method, maybe someone knows some way to solve it using standard Bitrix tools?
Maybe there is a way to set buffered content page properties?
The option to file everything down somewhere in the resalt modifier or not to offer in the template, many different components are connected and so on.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danil Isaev, 2020-01-28
@d4h1i15438

And if in the OnEpilog event put down? It is called at the end of the visual part, by that time the class should have already been worked out.
In init.php the following code:

\Bitrix\Main\EventManager::getInstance()->addEventHandler('main','OnEpilog','OnEpilogMeta'); 
function OnEpilog(){
    $APPLICATION->SetPageProperty("title", "some one else");
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question