M
M
microf2018-03-25 12:47:28
css
microf, 2018-03-25 12:47:28

How to compose news when displaying a component in Bitrix?

Good afternoon. It is necessary to pull a free template (bootstrap4) on Bitrix
5ab770756cb7c993391811.png
.

<section class="banner-sec float-left w-100 pt-4 pb-5">
    <div class="container-fluid">
        <div class="row px-3">
            <div class="col-md-3">
                <div class="card mb-4">...</div>
                <div class="card mb-4">...</div>
            </div>              
            <div class="col-md-6 top-slider">
                <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> 
                                  <ol class="carousel-indicators">...   </ol>
                    <!-- Wrapper for slides -->
                    <div class="carousel-inner" role="listbox">
                        <div class="carousel-item active">...   </div>         
                         <div class="carousel-item active">...   </div> 
                        <div class="carousel-item active">...   </div>                         
                </div>          
        </div>
    </div>
</section>

Those. 2 news items go to col-md-3, then 2 more news items to col-md-3, and then already col-md-6
How to use one Bitrix component in this case?
<? $ar_Filter = Array("SECTION_ID" => array(2501, 1862, 1892, 546, 1290)); ?>
                <?
                $APPLICATION->IncludeComponent(
                "template:news.list",
                "news_list",
                array(
                "IBLOCK_TYPE" => "news",
                "IBLOCK_ID" => "92",
                "NEWS_COUNT" => "2",
               ...
                "SEF_MODE" => "Y",
                "DETAIL_URL" => "/news/detail.php?ID=#ELEMENT_ID#",
            ...
                );
                ?>

Display three components in each of Or how? If you display three different ones, then how to set in the Bitrix component "we display 2 latest news here", "3 and 4 news" here, "5,6,7" here? <col-md-..>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2018-03-25
@microf

In one template, you can just use the counter

$k = 1;
foreach ($news as $new) {
if ($k === 3) {
} else if ($k === 4) {
} else {}
$k++;
}

V
Vladimir Skibin, 2018-03-25
@megafax

If the template then does not need to be divided and the news should be conditionally consistent in the output, for example, sorted by date in reverse order, then do everything in one Bitrix template. And in it already collect the arrays you need for different iterations from $arResult

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question