N
N
Nikita Sokolov2019-11-07 11:44:22
1C-Bitrix
Nikita Sokolov, 2019-11-07 11:44:22

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>

and put this in the index.php of the new section I created
<?
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");?>

The list of news itself on this page is displayed normally, but when you click on an element of this list, some strange page comes out, which simply says 123:
5dc3d65b7f604642291904.png
And when I try to change something on the page, this appears:
5dc3d9d1210c6055024938.png
If I start deleting something from the address bar, then the same thing opens. For some reason, the 404 page does not open... Although ErrorDocument is specified in .htaccess (I did not touch anything in the system files, I only added lines to after_connect that Bitrix suggested when checking).
In short, the question is where I turned the wrong way, what's the problem? Why is the news item not being displayed?
Bitrix support has been bothering me for a week with their answers every other day, everyone is trying to find an error in the server. I removed all errors in the server (the only thing left in red is the item about the PHP accelerator - it is not there).
Checking in the admin panel gives this:
5dc3db10e53e9913997218.png
Everything else is green

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akis, 2019-11-07
@wb_by

The news detail is displayed by the "bitrix:news.detail" component.
Haven't forgotten about him?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question