As through API Bitrix display additional image element of the information block?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
26 views
Hello! Need using bitrix api to display additional image element of the information block. There are multiple performance type File ATT_OW_MORE_PHOTO
The following code displays these images, but strange, if additional images three. it three times and displays the id and name and detailed text, how to rewrite it to output normal:
<?$iblock_id = 10;$arSelect = Array("ID", "NAME", "PROPERTY_ATT_OW_MORE_PHOTO", "DETAIL_PICTURE", "DETAIL_TEXT");$arFilter = Array( "IBLOCK_ID"=>$iblock_id, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y" ); $res = CIBlockElement::GetList(Array("SORT"=>"ASC"), $arFilter, false, false, $arSelect); while($ob = $res->GetNextElement()) : $arFields = $ob->GetFields(); echo "ID:" . $arFields['ID'];echo "
"; $db_old_groups = CIBlockElement::GetElementGroups($arFields['ID'], true); // while($ar_group = $db_old_groups->Fetch()) // echo "CODE SECTION:" . $ar_group["CODE"]." "; echo "
"; echo "NAME:" . $arFields['NAME'];echo "
"; echo "PICTURE: ".CFile::GetPath($arFields['DETAIL_PICTURE']);echo "
"; echo "DETAIL TEXT" . $arFields['DETAIL_TEXT'];echo "
"; echo "dop photo: "; echo "
image"; echo "
===================
"; endwhile; ?>
by | 26 views

2 Answers

0 like 0 dislike
the results GetList needs to be additional properties in the form of array ["PROPERTIES"]["ATT_OW_MORE_PHOTO"]

take it and run through the cycle
by
0 like 0 dislike
Decided that way:
<?\r$iblock_id = 10;\r$arSelect = Array("ID", "NAME", "CODE", "PROPERTY_ATT_OW_MORE_PHOTO", "DETAIL_PICTURE", "DETAIL_TEXT");\r$arFilter = Array( "IBLOCK_ID"=>$iblock_id, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y" ); $res = CIBlockElement::GetList(Array("SORT"=>"ASC"), $arFilter, false, false, $arSelect); $code = ""; while($ob = $res->GetNextElement()) : $arFields = $ob->GetFields(); if ($code != $arFields['CODE']) { $code = $arFields['CODE']; echo "ID:" . $arFields['ID'];echo "
"; $db_old_groups = CIBlockElement::GetElementGroups($arFields['ID'], true); while($ar_group = $db_old_groups->Fetch()) echo "SECTION CODE:" . $ar_group["CODE"]." "; echo "
"; echo "NAME:" . $arFields['NAME'];echo "
"; echo "CODE:" . $arFields['CODE'];echo "
"; echo "PICTURE: "."
image"; echo "
"; echo "DETAIL TEXT:" . $arFields['DETAIL_TEXT'];echo "
"; } echo "image"; endwhile; unset($iblock_id, $arSelect, $arFilter, $res, $code, $ob, $arFields, $db_old_groups); ?>
by
110,608 questions
257,187 answers
0 comments
40,796 users