N
N
nextnull2019-04-16 14:44:07
1C-Bitrix
nextnull, 2019-04-16 14:44:07

How to display 1 image from an array?

Hello, tell me pliz,
I have an infoblock, it has a file type property (multiple).
I display all pictures in this way.

<?if (!empty($arElement['PROPERTIES']['MORE_PHOTO']['VALUE'])):?>
   <?foreach($arElement['PROPERTIES']['MORE_PHOTO']['VALUE'] as $photo):?>
         <img src="<?=CFile::GetPath($photo)?>" />
   <?endforeach?>

How can I display one card from this array.
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
2
2cha.headz, 2019-04-16
@nextnull

Can you do something like this

<?if($arElement['PROPERTIES']['MORE_PHOTO']['VALUE'][0]):?>
    <img src="<?=CFile::GetPath($arElement['PROPERTIES']['MORE_PHOTO']['VALUE'][0]?>" />
<?endif?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question