Answer the question
In order to leave comments, you need to log in
How to display 2 $arItem['ID'] Bitrix in news?
There is a slider connected to the template bitrix.news.
Tell me how to make it so that 2 elements are displayed in one slide, that is, in the first 1.2 in the second 3.4, etc.
<div class="slider">
<ul class="slides">
<?foreach($arResult["ITEMS"] as $arItem):?>
<?
$this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT"));
$this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM')));
?>
<li class="slide news-item" id="<?=$this->GetEditAreaId($arItem['ID']);?>">
<a href="<?echo $arItem["DETAIL_PAGE_URL"]?>"><b><?echo $arItem["NAME"]?></b></a><br />
<?echo $arItem["PREVIEW_TEXT"];?>
</li>
<?endforeach;?></ul>
Answer the question
In order to leave comments, you need to log in
<ul class="slides">
<?
$arItemsChunks = array_chunk($arResult["ITEMS"], 2, true);
foreach($arItemsChunks as $arChunk):?>
<li class="slide news-item">
<?foreach($arChunk as $key => $arItem):?>
<?
$this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT"));
$this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM')));
?>
<a href="<?echo $arItem["DETAIL_PAGE_URL"]?>"><b><?echo $arItem["NAME"]?></b></a><br />
<?echo $arItem["PREVIEW_TEXT"];?>
<?endforeach;?>
</li>
<?endforeach;?>
</ul>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question