A
A
Alex2016-03-20 23:41:47
1C-Bitrix
Alex, 2016-03-20 23:41:47

How to display a field for describing the value of the infoblock property?

Hello, available in news.list

<?if (!empty($arItem["PROPERTIES"]["FILE"]["VALUE"])):?>
<?foreach($arItem["PROPERTIES"]["FILE"]["VALUE"] as $PHOTOS):
$file = CFile::ResizeImageGet($PHOTOS, array('width'=>150, 'height'=>'112'), BX_RESIZE_IMAGE_EXACT, true); 
?>
<div><a href="<?=CFile::GetPath($PHOTOS)?>">
<img src="<?=$file["src"]?>" alt="<?=$arItem["PROPERTIES"]["FILE"]["DESCRIPTION"][$PHOTOS];?>" /></a>
</div> 
<?endforeach?>
<?endif?>

How to display property description in alt image?
here is
<?=$arItem["PROPERTIES"]["FILE"]["DESCRIPTION"][$PHOTOS];?>"

does not work(((

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel Bezrukov, 2016-03-21
@bezrukovPS

In the foreach add $key and substitute it as the key of the DESCRIPTION array.

R
Rad1calDreamer, 2016-03-21
@Rad1calDreamer

first, remove the logic from the template in result_modifier.
secondly, organize the loop so that you can access the array in which both the description and the value are stored by key

D
demaio, 2021-01-27
@demaio

Solution for displaying a multiple property of type string with a field to describe the value:

<?foreach($arResult["PROPERTIES"]["СВОЙСТВО"]["VALUE"] as $k=>$value):?>
<?=$value?> <?=$arResult["PROPERTIES"]["СВОЙСТВО"]["DESCRIPTION"][$k]?>
<?endforeach?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question