D
D
Diversia2019-02-18 08:52:55
1C-Bitrix
Diversia, 2019-02-18 08:52:55

How to make pagination in Bitrix in your component?

There is an infoblock with elements. Can you please tell me how to make pagination in the development of your component? It is possible some elementary example which will break elements on 20 elements. If we take the standard news.list component, we'll go to hell to catch what we need and use it in our component.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2019-02-18
@jasper-blondin

If we take the standard component news.list - we’ll catch the hell out of there

See the news.line component. It is simple and contains chunking.
According to the navigation itself, everything is written here (D7 core): https://dev.1c-bitrix.ru/learning/course/index.php...
If for some reason you need the old style:
$arFilter = Array("IBLOCK_ID" => 22, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, array("nPageSize" => 20), Array());
$res->NavStart(0);
while ($ob = $res->GetNextElement()) {
  $product_fields_list = $ob->GetFields();
  $product_props_list = $ob->GetProperties();
  
  echo "<pre>";
  print_r($product_fields_list);
  echo "</pre>";
}

$navStr = $res->GetPageNavStringEx($navComponentObject, "Страницы:", ".default");
echo $navStr;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question