A
A
Alexey2016-02-08 18:55:00
PHP
Alexey, 2016-02-08 18:55:00

How to display the properties of an element in the news list?

Hello,
There is Bitrix and the bitrix:news.list module.
Please tell me how to display the properties of an element in the bitrix:news.list module separately from each other (output through foreach is not suitable).
I found the only solution - note.dimexio.ru/?p=748 , but I can't use it because I don't have enough brain.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-02-08
@alexey-ys

Dirty way but fast: if you need to display strongly from each other - create a forich in the place where you need, select all properties and check for the property name display data on it.

A
Alexey, 2016-02-09
@alexey-ys

I am writing a guide for myself.
Output of the element property in the bitrix:news.list module separately from each other.
Output of one property:

<?foreach($arItem["DISPLAY_PROPERTIES"] as $pid=>$arProperty):?>
  <?if($arProperty["CODE"]=="PROPERTYCODE"):?>
    <?=$arProperty["DISPLAY_VALUE"];?>,&nbsp;
  <?endif;?>
<?endforeach;?>

Displaying a property with the condition "show if there is no first"
<?foreach($arItem["DISPLAY_PROPERTIES"] as $pid=>$arProperty):?>
  <?if($arProperty["CODE"]=="PROPERTYFIRST" && is_array($arItem["DISPLAY_PROPERTIES"]["PROPERTYFIRST"])):?>
    <?=$arProperty["DISPLAY_VALUE"];?>
  <?elseif($arProperty["CODE"]=="PROPERTYSCND"):?>
    <?if(!is_array($arItem["DISPLAY_PROPERTIES"]["PROPERTYFIRST"])):?>
      <?=$arProperty["DISPLAY_VALUE"];?>
    <?endif;?>
  <?endif;?>
<?endforeach;?>

Displaying a property with the condition "show if nothing else is specified when adding"
<?foreach($arItem["DISPLAY_PROPERTIES"] as $pid=>$arProperty):?>
  <?if($arProperty["CODE"]=="PROPERTYSCND"):?>
    <?if(!is_array($arItem["DISPLAY_PROPERTIES"]["PROPERTYFIRST"])):?>
      <?=$arProperty["DISPLAY_VALUE"];?>
    <?endif;?>
  <?endif;?>
<?endforeach;?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question