V
V
Vadim Timoshenko2019-10-31 15:16:17
1C-Bitrix
Vadim Timoshenko, 2019-10-31 15:16:17

How to display only some elements from the infoblock?

I have a code that displays all the elements of the infoblock:

$APPLICATION->IncludeComponent(
  "bitrix:news.list",
  "rubrikator_carou",
  array(
      "ACTIVE_DATE_FORMAT" => "d.m.Y",
      "ADD_SECTIONS_CHAIN" => "N",
      "AJAX_MODE" => "N",
      "AJAX_OPTION_ADDITIONAL" => "",
      "AJAX_OPTION_HISTORY" => "N",
      "AJAX_OPTION_JUMP" => "N",
      "AJAX_OPTION_STYLE" => "N",
      "CACHE_FILTER" => "N",
      "CACHE_GROUPS" => "Y",
      "CACHE_TIME" => "36000000",
      "CACHE_TYPE" => "A",
      "CHECK_DATES" => "Y",
      "COMPONENT_TEMPLATE" => "rubrikator_carou",
      "DETAIL_URL" => "",
      "DISPLAY_BOTTOM_PAGER" => "N",
      "DISPLAY_DATE" => "N",
      "DISPLAY_NAME" => "Y",
      "DISPLAY_PICTURE" => "Y",
      "DISPLAY_PREVIEW_TEXT" => "N",
      "DISPLAY_TOP_PAGER" => "N",
      "FIELD_CODE" => array(
        0 => "NAME",
        1 => "PREVIEW_PICTURE",
        2 => "",
      ),
      "FILTER_NAME" => "arrFilterRub",
      "HIDE_LINK_WHEN_NO_DETAIL" => "N",
      "IBLOCK_ID" => "13",
      "IBLOCK_TYPE" => "simple",
      "INCLUDE_IBLOCK_INTO_CHAIN" => "N",
      "INCLUDE_SUBSECTIONS" => "N",
      "MEDIA_PROPERTY" => "",
      "MESSAGE_404" => "",
      "NEWS_COUNT" => "100",
      "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" => ".default",
      "PAGER_TITLE" => "Рубрикатор",
      "PARENT_SECTION" => "",
      "PARENT_SECTION_CODE" => "",
      "PREVIEW_TRUNCATE_LEN" => "",
      "PROPERTY_CODE" => array(
        0 => "LINK",
        1 => "PRICE",
        2 => "",
      ),
      "SEARCH_PAGE" => "/search/",
      "SET_BROWSER_TITLE" => "N",
      "SET_LAST_MODIFIED" => "N",
      "SET_META_DESCRIPTION" => "N",
      "SET_META_KEYWORDS" => "N",
      "SET_STATUS_404" => "N",
      "SET_TITLE" => "N",
      "SHOW_404" => "N",
      "SLIDER_PROPERTY" => "",
      "SORT_BY1" => "SORT",
      "SORT_BY2" => "ID",
      "SORT_ORDER1" => "DESC",
      "SORT_ORDER2" => "DESC",
      "STRICT_SECTION_CHECK" => "N",
      "TEMPLATE_THEME" => "blue",
      "USE_RATING" => "N",
      "USE_SHARE" => "N"
  ),
  false
  );

But I need elements with specific IDs. Any parameter to help me filter out the excess? Where to write an array with IDs?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Kirshin, 2019-10-31
@PbI6A_KuT

You already have some kind of filter defined, and in general, if from scratch, then something like this:

// перед вызовом компонента
global $arrFilter;
$arrFilter = [
  "ID" => array(2,5,6)
];
// в параметрах компонента
"FILTER_NAME" => "arrFilter",

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question