Answer the question
In order to leave comments, you need to log in
How to display a specific custom field in news.list?
Good afternoon! I got a problem. The page has a news component with custom fields (SUB_HEADER and PRICE).
If the fields are displayed in a cycle, then they are displayed in both news.list and news.detail, I display them like this:
<?foreach($arItem["DISPLAY_PROPERTIES"] as $pid=>$arProperty):?>
<?=$arProperty["NAME"]?>:
<?if(is_array($arProperty["DISPLAY_VALUE"])):?>
<?=implode(" / ", $arProperty["DISPLAY_VALUE"]);?>
<?else:?>
<?=$arProperty["DISPLAY_VALUE"];?>
<?endif?>
<br /> <?endforeach;?>
<?if(!empty($arResult["DISPLAY_PROPERTIES"]["SUB_HEADER"]["VALUE"])):?>
<?=$arResult["DISPLAY_PROPERTIES"]["SUB_HEADER"]["VALUE"]?>
<?endif;?>
Answer the question
In order to leave comments, you need to log in
if the bottom code is from news.list then why is there $arResult and not $arItem? As in the top version. In the same place $arResult in foreach gets over as $arItem.
If I remember it right...
<?if(!empty($arItem["DISPLAY_PROPERTIES"]["SUB_HEADER"]["VALUE"])):?>
<?=$arItem["DISPLAY_PROPERTIES"]["SUB_HEADER"]["VALUE"]?>
<?endif;?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question