Answer the question
In order to leave comments, you need to log in
Title in catalog.section?
Good day to all. Now I'm facing this problem:
The entire catalog is made on 1 page, into 3 files /catalog/list.php, /catalog/index.php, /catalog/detail.php. When switching to another section, the contents of the section are simply pulled up by Ajax and displayed. It is necessary that each section has its own title. Through SetPagePropety it turns out, but it is necessary that the value be output from the section settings (SEO), so that the client simply fills in the admin panel. Here's a gag - getting the value that is specified in the admin panel does not work. I tried to use it from the training, but it goes along the branch return "Standard page"; title is empty. Tried all settings and component and page changes. Still, of course, there will be a problem that the title will not change until the page is reloaded, but this tile still needs to be received, but this does not work out.
The code
$APPLICATION->AddBufferContent('ShowCondTitle');
function ShowCondTitle()
{
global $APPLICATION;
if (!$APPLICATION->GetTitle())
return "Standard Page";
else
return $APPLICATION->GetTitle();
}
$APPLICATION->SetPageProperty("title", ShowCondTitle());
Thank you!
Answer the question
In order to leave comments, you need to log in
and what exactly is the problem?
You can get the SEO fields for an element like this:
CModule::IncludeModule("iblock");
$ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues(
$arCurElem["IBLOCK_ID"], // infoblock ID
$arCurElem["ID"] // element ID
);
$arElMetaProp = $ipropValues->getValues();
echo ''; print_r($arElMetaProp); echo '';
The SEO fields for a section can be obtained in a similar way:
CModule::IncludeModule("iblock");
$rsSection = CIBlockSection::GetList(
array(),
array(
"IBLOCK_ID"=>$arParams['IBLOCK_ID'],
"ACTIVE"=>"Y",
false
);
if($arSection = $rsSection->GetNext()){
$ipropValues = new \Bitrix\Iblock\InheritedProperty\SectionValues(
$arSection["IBLOCK_ID"],
$arSection["ID"]
);
$arSection["IPROPERTY_VALUES"] = $ipropValues->getValues();
echo ""; print_r($arSection); echo '';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question