Answer the question
In order to leave comments, you need to log in
How to make reverse pagination in Bitrix HighloadBlock?
There is an example on infoblocks how to make pagination. Can you please tell me how to fit this code only under HighloadBlock ?
<?
$filter = array("=IBLOCK_ID"=>6);
$cnt = \Bitrix\Iblock\ElementTable::getCount($filter);
$nav = new \Bitrix\Main\UI\ReversePageNavigation("nav-news", $cnt);
$nav->allowAllRecords(true)
->setPageSize(5)
->initFromUri();
$newsList = \Bitrix\Iblock\ElementTable::getList(
array(
"filter" => $filter,
"offset" => $nav->getOffset(),
"limit" => $nav->getLimit(),
)
);
while($news = $newsList->fetch())
{
}
?>
<?
$APPLICATION->IncludeComponent(
"bitrix:main.pagenavigation",
"",
array(
"NAV_OBJECT" => $nav,
"SEF_MODE" => "Y",
),
false
);
?>
Answer the question
In order to leave comments, you need to log in
<?php
\Bitrix\Main\Loader::includeModule('highloadblock');
$hlBlockId = 1;
$hlObject = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlBlockId)->fetch();
$entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlObject);
$entity_data_class = $entity->getDataClass();
$newsList = $entity_data_class::getList([
'filter' => $filter,
'offset' => $nav->getOffset(),
'limit' => $nav->getLimit(),
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question