A
A
Alexander Chibilyaev2015-12-29 15:32:03
1C-Bitrix
Alexander Chibilyaev, 2015-12-29 15:32:03

How to make pagination in Bitrix top directory?

Tell me how to display the paginator in the TOP in the Bitrix complex component?
Set "TOP_ELEMENT_COUNT" => "20",

// Задаем количество элементов на странице
$countOnPage = 20;
// Исходный массив данных для списка
$elements = $arResult['ITEMS'];
// Получаем номер текущей страницы из реквеста
$page = intval($_GET['PAGEN_1']);
// Отбираем элементы текущей страницы
$elementsPage = array_slice($elements, $page * $countOnPage, $countOnPage);
// Вывод страницы
echo printPage($elementsPage);
// Подготовка параметров для пагинатора
$navResult = new CDBResult();
$navResult->NavPageCount = ceil(count($elements) / $countOnPage);
$navResult->NavPageNomer = $page;
$navResult->NavNum = 1;
$navResult->NavPageSize = $countOnPage;
$navResult->NavRecordCount = count($elements);
// Вывод пагинатора
$APPLICATION->IncludeComponent('bitrix:system.pagenavigation', 'aac', array(
    'NAV_RESULT' => $navResult,
));

and in the printPage function I make an array output
Or I put "TOP_ELEMENT_COUNT" => "2000", 2 pages appear, but they are empty.
Tell me how to fix?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2015-12-29
@gangstarcj

Why is there pagination in the top? for the same there is a section

A
Andrey Kornev, 2015-12-30
@webkornevand

No way.
The component outputs a list of all sections of the top elements.
Pagination in this component is not provided at all.
Now you can only customize the component or write your own with preference and courtesans.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question