Помогите настроить вывод элементов. Элементы выводится но стоит задача выводить по 4 элемента в ряд, а если элемента 3 то доложен быть одно пустое место.
Вывожу элементы следующим кодом.
Вывожу элементы следующим кодом.
| Код |
|---|
<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();
use \Bitrix\Main\Localization\Loc;
/**
* @global CMain $APPLICATION
* @var array $arParams
* @var array $arResult
* @var CatalogSectionComponent $component
* @var CBitrixComponentTemplate $this
* @var string $templateName
* @var string $componentPath
*
* _________________________________________________________________________
* | Attention!
* | The following comments are for system use
* | and are required for the component to work correctly in ajax mode:
* | <!-- items-container -->
* | <!-- pagination-container -->
* | <!-- component-end -->
*/
$this->setFrameMode(true);
$elementEdit = CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'ELEMENT_EDIT');
$elementDelete = CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'ELEMENT_DELETE');
$elementDeleteParams = array('CONFIRM' => GetMessage('CT_BCS_TPL_ELEMENT_DELETE_CONFIRM'));
if (!empty($arResult['ITEMS'])) {
?>
<div class="magazine__list">
<?
$itemsCounter = 0;
foreach ($arResult['ITEMS'] as $item):
$this->AddEditAction($item['ID'], $item['EDIT_LINK'], $elementEdit);
$this->AddDeleteAction($item['ID'], $item['DELETE_LINK'], $elementDelete, $elementDeleteParams);
$itemsCounter++;
?>
<div class="magazine__item" id="<?= $this->GetEditAreaId($item['ID']); ?>">
<a href="<?= $item["DETAIL_PAGE_URL"]?>">
<span class="magazine__item-picture">
<img src="<?= $item["PREVIEW_PICTURE"]["SRC"] ?>" alt="<?= $item["NAME"]?>">
</span>
<span class="magazine__item-number"><?= $item["NAME"]?></span>
</a>
</div>
<? endforeach; ?>
</div>
<?
}
|
