Answer the question
In order to leave comments, you need to log in
How to check if a page property exists (deferred functions)?
Russian-language and similar English-language information block "News" is given. Elements of these infoblocks are linked by the "Binding to infoblock element" property. It is necessary to display a bitrix:main.site.selector
link to the related element in the component template (the component is called in header.php).
I set the page property in component_epilog.php with the value of the DETAIL_PAGE_URL
associated element:
if (!empty($arResult['PROPERTY_NEWS_ID_DETAIL_PAGE_URL'])) { // свойство "Привязка к элементу инфоблока"
$APPLICATION->SetPageProperty('link', $arResult['PROPERTY_NEWS_ID_DETAIL_PAGE_URL']);
}
bitrix:main.site.selector
property: $APPLICATION->ShowProperty('link');
bitrix:main.site.selector
if the link page property exists? If it exists, then display its content, otherwise display a link to the main page of a foreign-language site (for example, en/ for the English language version).$APPLICATION->ShowProperty()
a cacheable component in template.php?Answer the question
In order to leave comments, you need to log in
move the component to the footer))
<?
ob_start();
// вызов компонента
$mainSiteSelectorComponent = ob_get_contents();
ob_end_clean();
$APPLICATION->AddViewContent('mainSiteSelectorComponent', $mainSiteSelectorComponent);
?>
<?$APPLICATION->ShowViewContent('mainSiteSelectorComponent');?>
$APPLICATION->GetProperty('link');
$propertyLink = $APPLICATION->GetProperty('link');
if($propertyLink) {
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question