S
S
Sergey Demin2018-08-30 21:45:06
1C-Bitrix
Sergey Demin, 2018-08-30 21:45:06

How to make output in 2 columns?

I welcome everyone.
There is a template code for the bitrix.news.list component

Lots of code
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true);
?>
<div class="news-list">
<?if($arParams["DISPLAY_TOP_PAGER"]):?>
    <?=$arResult["NAV_STRING"]?><br />
<?endif;?>
<?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')));
    ?>
<div class="row">
                <div class="col-xs-11 col-sm-6 col-md-6">
                <?if($arParams["DISPLAY_PICTURE"]!="N" && is_array($arItem["PREVIEW_PICTURE"])):?>
                    <?if(!$arParams["HIDE_LINK_WHEN_NO_DETAIL"] || ($arItem["DETAIL_TEXT"] && $arResult["USER_HAVE_ACCESS"])):?>
                    <div class="thumbnail">
                        <img class="img-responsive" src="<?=$arItem["PREVIEW_PICTURE"]["SRC"]?>" width="<?=$arItem["PREVIEW_PICTURE"]["WIDTH"]?>" height="<?=$arItem["PREVIEW_PICTURE"]["HEIGHT"]?>" alt="<?=$arItem["PREVIEW_PICTURE"]["ALT"]?>" title="<?=$arItem["PREVIEW_PICTURE"]["TITLE"]?>">
                        <div class="caption">
                        <?if($arParams["DISPLAY_NAME"]!="N" && $arItem["NAME"]):?>
                            <h4><span class="title-news"><a href="<?echo $arItem["DETAIL_PAGE_URL"]?>" class="link"><?echo $arItem["NAME"]?></a></span></h4>
                            <?endif;?>
                            <?if($arParams["DISPLAY_DATE"]!="N" && $arItem["DISPLAY_ACTIVE_FROM"]):?>
                            <p><small><i class="far fa-calendar-alt"></i> <?echo $arItem["DISPLAY_ACTIVE_FROM"]?><?endif?> <i class="far fa-comments"></i> 50 <i class="far fa-eye"></i> 105</small><span class="badge pull-right">Общество</span></p>
                            <?if($arParams["DISPLAY_PREVIEW_TEXT"]!="N" && $arItem["PREVIEW_TEXT"]):?>
                            <p class="text-justify"><?echo $arItem["PREVIEW_TEXT"];?></p><?endif;?>
                            <p><a class="btn btn-primary" role="button" href="<?=$arItem["DETAIL_PAGE_URL"]?>">Подробнее</a></p>
                        </div>
                    </div>
                    <?endif;?>
                <?endif?>
                </div>
                <div class="col-xs-11 col-sm-6 col-md-6">
                    <div class="media">
                        <a class="pull-left" href="#">
                            <img class="img-responsive" src="http://via.placeholder.com/200x100">
                        </a>
                        <div class="media-body">
                            <h4 class="media-heading"><a href="#" class="link">Муниципальный долг Анапы снизился на 20%</a></h4>
                            <p><small><i class="far fa-calendar-alt"></i> 25.08.2017 13:18 <i class="far fa-comments"></i> 50 <i class="far fa-eye"></i> 105</small><span class="badge pull-right">Культура</span></p>
                            <p class="pull-right"><a href="#" class="btn btn-default" role="button">Подробнее</a></p>
                        </div>
                    </div>
                    <hr>
                    <div class="media">
                        <a class="pull-left" href="#">
                            <img class="img-responsive" src="http://via.placeholder.com/200x100">
                        </a>
                        <div class="media-body">
                            <h4 class="media-heading"><a href="#" class="link">Проверки нарушений прав дольщиков проведут в Анапе</a></h4>
                            <p><small><i class="far fa-calendar-alt"></i> 25.08.2017 13:18 <i class="far fa-comments"></i> 50 <i class="far fa-eye"></i> 105</small><span class="badge pull-right">Происшествия</span></p>
                            <p class="pull-right"><a href="#" class="btn btn-default" role="button">Подробнее</a></p>
                        </div>
                    </div>
                    <hr>
                    <div class="media">
                        <a class="pull-left" href="#">
                            <img class="img-responsive" src="http://via.placeholder.com/200x100">
                        </a>
                        <div class="media-body">
                            <h4 class="media-heading"><a href="#" class="link">В Анапе вновь запретили купание</a></h4>
                            <p><small><i class="far fa-calendar-alt"></i> 25.08.2017 13:18 <i class="far fa-comments"></i> 50 <i class="far fa-eye"></i> 105</small><span class="badge pull-right">Экономика</span></p>
                            <p class="pull-right"><a href="#" class="btn btn-default" role="button">Подробнее</a></p>
                        </div>
                    </div>
                </div>
<?endforeach;?>
<?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
    <br /><?=$arResult["NAV_STRING"]?>
<?endif;?>
</div>


Task: to make a news output, as in the picture. I tried using array_chunk to split the array, but then it doesn't output anything at all. I can't figure out where I screwed up.
5b883ab38da19655264433.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question