Answer the question
In order to leave comments, you need to log in
How to display the name of the parent of the news in the Bitrix news list?
This is how I display a link to the news parent:
<? preg_match("/\/(.*)\/(.*)\/(.*)\//",$arItem["DETAIL_PAGE_URL"], $matches);?>
<a href="<?foreach($matches as $key=>$valuer){if($key == 12){echo "/".$matches[1]."/".$matches[2]."/";}}?>" class="red"> <? echo "ИМЯ РОДИТЕЛЯ НОВОСТИ"?>
</a>
<h3>Заголовок новости -<?=$arItem["NAME"]?></h3>
// $arResult["SECTION"]["PATH"][0]["NAME"] -
Answer the question
In order to leave comments, you need to log in
I dug Bitrix on the forum, after all I was close
<?foreach($arResult["ITEMS"] as $key=>$arItem):
$res = CIBlockSection::GetByID($arItem["IBLOCK_SECTION_ID"]);
if($ar_res = $res->GetNext())
echo $arResult["ITEMS"][$key]["IBLOCK_SECTION_NAME"] = $ar_res['NAME'];
endforeach;?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question