Answer the question
In order to leave comments, you need to log in
How to filter the list of news by dates Activity start and Activity end?
It is necessary to set filtering for the list of news that is displayed through the news.list component
by the start date of activity (DATE_ACTIVE_FROM) and date end of activity (DATE_ACTIVE_TO)
I know that the easiest way to filter the list is using arrFilter
Now I filter this way:
$from = date('10.01.2021');
$to = date("16.01.2021");
$arrFilter = Array(
">=DATE_ACTIVE_FROM" => $from,
"<=DATE_ACTIVE_TO" => $to
);
APPLICATION->IncludeComponent(
"bitrix:news.list",
"slider_main",
Array(
"FILTER_NAME" => "arrFilterDate",
…
)
);
Answer the question
In order to leave comments, you need to log in
Copy the component template and add .parameters.php to it with the settings you need. But in this case, they will not be taken into account in the news selection, because GetList knows nothing about them.
You can read more here https://ydmitry.ru/blog/4-sposoba-rasshirit-standa...
Alternatively, you can place an additional "configuration" component in front of the component, the settings of which will fall into the global arrFilter for your component, but this is too frozen for your case.
It's easier to customize a standard component for your task.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question