Answer the question
In order to leave comments, you need to log in
How to make check of delayed ShowProperty function?
How to make a check of the deferred function ShowProperty,
in the news component > in the detailed template of the component I set
$APPLICATION->SetPageProperty("H_tit", "какой-то текст"; ?>
<h1><?php
$H_tit = $APPLICATION->GetProperty("H_tit");
if (strlen($H_tit)>0 ): ?>
<?php $APPLICATION->ShowProperty("H_tit"); ?>
<?php else: ?>
<?$APPLICATION->ShowTitle()?>
<?php endif ?></h1>
<h1><?php
$H_tit = $APPLICATION->ShowProperty("H_tit");
if (strlen($H_tit)>0 ): ?>
<?php $APPLICATION->ShowProperty("H_tit"); ?>
<?php else: ?>
<?$APPLICATION->ShowTitle()?>
<?php endif ?></h1>
Answer the question
In order to leave comments, you need to log in
Here is what Bitrix says about deferred functions:
Attention! When using this technology, you must take into account that you cannot perform any actions on the results of the work of functions that provide the deferral of other functions.
The value returned by the deferred function is not returned, but immediately rendered at the call site of AddBufferContent, and whatever is rendered in the deferred function will be rendered before the start of the template.
$APPLICATION->SetTitle("Заголовок 1"); //- задать заголовок страницы
$APPLICATION->SetPageProperty('title','Заголовок 2');// - тоже задать заголовок страницы (но эта функция имеет приоритет над первой)
<?$APPLICATION->ShowTitle()?> - показ заголовка страницы // покажет заголовок 1
<?$APPLICATION->ShowTitle(false)?> - показ заголовка страницы, заданного через SetTitle // покажет заголовок 2
Here is an example through deferred functions, you can do it by analogy. As already noted, SetPageProperty must be called in component_epilog.php
How to find out that we are in the product card of the catalog component?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question