K
K
ksenia_strakhova2021-03-12 13:08:19
1C-Bitrix
ksenia_strakhova, 2021-03-12 13:08:19

Bitrix how to display a list of news, excluding the current one?

Site on bitrix. A list of all news is also displayed on the page of a separate news item. How to exclude the current news from this list?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yaroslav Alexandrov, 2021-03-12
@alexyarik

Add a filter to the call code of the news component excluding the current news

<?$GLOBALS['press_filter'] = array('!ID'=>$arResult['ID']);?>
$APPLICATION->IncludeComponent(
  "bitrix:news.list", 
  "", 
  array(
    "FILTER_NAME" => "press_filter",

D
Dmitry, 2021-03-13
@Deemc

In detail.php, there are no entry id parameters in the $arResult array. Alternatively, use a symbolic code.

$GLOBALS['arrFilter'] = array('!CODE' => $arResult['VARIABLES']['ELEMENT_CODE'];

K
ksenia_strakhova, 2021-03-15
@ksenia_strakhova

Unfortunately, also to no avail. Posted in detail.php https://yadi.sk/i/uGlYnN0a0Wbu3w
the filter names are the same, the filter itself is enabled. It seems like a standard task, but I don’t understand how to do it)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question