Answer the question
In order to leave comments, you need to log in
How to compose news when displaying a component in Bitrix?
Good afternoon. It is necessary to pull a free template (bootstrap4) on Bitrix
.
<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>
col-md-3
, then 2 more news items to col-md-3
, and then already col-md-6
<? $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#",
...
);
?>
<col-md-..>
Answer the question
In order to leave comments, you need to log in
In one template, you can just use the counter
$k = 1;
foreach ($news as $new) {
if ($k === 3) {
} else if ($k === 4) {
} else {}
$k++;
}
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 questionAsk a Question
731 491 924 answers to any question