Answer the question
In order to leave comments, you need to log in
How to program a slider on Bitrix?
Good afternoon!
I need to make a small slider.
Using Catalog.section
Here is a snippet from the result modifire for the slider.
foreach ($arResult["PROPERTY_IMAGES_VALUE"] as $arImages)
{
$arResult["IMAGES"][] = CFile::GetFileArray($arImages);
}
<?foreach ($arResult["ITEMS"] as $arItem) {?>
<div class = "slider" id = "slider_images-<?=$arItem["ID"]?>">
<div class = "slider">
<?foreach ($arItem["IMAGES"] as $arPhoto) {
?><div><img src="<?=$arPhoto["SRC"]?>"></div><?
}?>
</div>
<div class = "s-navigation">
<?foreach ($arItem["IMAGES"] as $arPhoto) {
?><div><img src="<?=$arPhoto["SRC"]?>"></div><?
}?>
</div>
</div>
<?
}?>
var_dump($arResult["IMAGES"])
Answer the question
In order to leave comments, you need to log in
You use catalog.section, which, firstly, has a selection of elements in $arResult["ITEMS"], and secondly, PROPERTY_IMAGES_VALUE is used if you yourself will select properties via CIBlockElement::GetList (but since images are stored in a multiple property, then this is usually solved not through CIBlockElement::GetList, but through CIBlockProperty::GetList).
Since you are processing a ready-made selection of elements in result_modifier.php, then access to the values of the properties of the elements goes not through PROPERTY_IMAGES_VALUE, but like this: ["PROPERTIES"]["IMAGES"]["VALUE"].
Those. In the general case, for your option, you need such a construction:
foreach ($arResult["ITEMS"] as &$arItem)
{
$arItem["IMAGES"] = array();
foreach ($arItem["PROPERTIES"]["IMAGES"]["VALUE"] as $imageId)
{
$arItem["IMAGES"][] = CFile::GetFileArray($imageId);
}
}
unset($arItem);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question