Answer the question
In order to leave comments, you need to log in
How to display news details in Bitrix?
I'm trying to learn Bitrix, I made a theme according to my layout (I put it in local). It seems like I didn’t turn anything unusual there - everything was according to the tutorial. I made a new type of infoblock - news (the idea was to make my own). I made my own template for displaying a list of news:
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$this->setFrameMode(true);?>
<div class="row">
<?foreach($arResult["ITEMS"] as $arItem):?>
<div class="col-12 col-md-6 col-xl-4">
<a class="card mt-4 text-body text-decoration-none" href=<?=$arItem["DETAIL_PAGE_URL"]?>>
<img class="card-img-top" src=<?=$arItem["PREVIEW_PICTURE"]["SRC"]?> alt="image"/>
<div class="card-body">
<h4 class="card-title"><?=$arItem["NAME"]?></h4>
<p class="card-text"><?=$arItem["PREVIEW_TEXT"]?></p>
<!--p class="card-text"><small class="text-muted">20.10.2019, 15:00</small></p-->
</div>
</a>
</div>
<?endforeach;?>
</div>
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Новости");
?><main class="container mt-5 mb-5">
<h1>Новости</h1>
<?$APPLICATION->IncludeComponent(
"bitrix:news.list",
"news_list",
Array(
"ACTIVE_DATE_FORMAT" => "d.m.Y",
"ADD_SECTIONS_CHAIN" => "N",
"AJAX_MODE" => "Y",
"AJAX_OPTION_ADDITIONAL" => "",
"AJAX_OPTION_HISTORY" => "N",
"AJAX_OPTION_JUMP" => "N",
"AJAX_OPTION_STYLE" => "Y",
"CACHE_FILTER" => "N",
"CACHE_GROUPS" => "Y",
"CACHE_TIME" => "36000000",
"CACHE_TYPE" => "A",
"CHECK_DATES" => "Y",
"DETAIL_URL" => "",
"DISPLAY_BOTTOM_PAGER" => "Y",
"DISPLAY_DATE" => "Y",
"DISPLAY_NAME" => "Y",
"DISPLAY_PICTURE" => "Y",
"DISPLAY_PREVIEW_TEXT" => "Y",
"DISPLAY_TOP_PAGER" => "N",
"FIELD_CODE" => array("ACTIVE_FROM",""),
"FILTER_NAME" => "",
"HIDE_LINK_WHEN_NO_DETAIL" => "Y",
"IBLOCK_ID" => "9",
"IBLOCK_TYPE" => "news",
"INCLUDE_IBLOCK_INTO_CHAIN" => "N",
"INCLUDE_SUBSECTIONS" => "N",
"MEDIA_PROPERTY" => "",
"MESSAGE_404" => "",
"NEWS_COUNT" => "6",
"PAGER_BASE_LINK_ENABLE" => "N",
"PAGER_DESC_NUMBERING" => "N",
"PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
"PAGER_SHOW_ALL" => "N",
"PAGER_SHOW_ALWAYS" => "N",
"PAGER_TEMPLATE" => "bootstrap_v4",
"PAGER_TITLE" => "Новости",
"PARENT_SECTION" => "",
"PARENT_SECTION_CODE" => "",
"PREVIEW_TRUNCATE_LEN" => "",
"PROPERTY_CODE" => array("AUTHOR",""),
"SEARCH_PAGE" => "/search/",
"SET_BROWSER_TITLE" => "N",
"SET_LAST_MODIFIED" => "N",
"SET_META_DESCRIPTION" => "N",
"SET_META_KEYWORDS" => "N",
"SET_STATUS_404" => "Y",
"SET_TITLE" => "N",
"SHOW_404" => "N",
"SLIDER_PROPERTY" => "",
"SORT_BY1" => "ACTIVE_FROM",
"SORT_BY2" => "SORT",
"SORT_ORDER1" => "DESC",
"SORT_ORDER2" => "ASC",
"STRICT_SECTION_CHECK" => "N",
"TEMPLATE_THEME" => "blue",
"USE_RATING" => "N",
"USE_SHARE" => "N"
)
);?> </main><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question