For example, the catalog page, where 69 pages.

The pagination component is connected only in the body of the page, where you can get the total number of pages.

But you need to get their number in heder. How to do it?

I read, it seems like through the deferred functions this is implemented, but I did not find suitable examples.

In the pagination template posted code:

<?php $this->SetViewTarget('nav_page_count');?> <?php $APPLICATION->AddViewContent('nav_page_count', $arResult["NavPageCount"]);?> <?php $this->EndViewTarget();?> 

In header.php I get what I want:

 $APPLICATION->ShowViewContent('nav_page_count') 

Everything is good, but this number is simply displayed in the form of content, but I need not to display, but to work as with a variable.

How to get this data as a variable?

enter image description here

enter image description here

  • Have you ever tried to do something? How to adapt the examples that you find? - Nikolaj Sarry
  • If to solve by a rough method, then in the header, make a request through the API to calculate the number of elements in the information block that should be output. And divide by the number of items that can be displayed on the page. Here you have your number and no deferred functions. But with them it is still more correct. - Nikolaj Sarry
  • It is not clear how to get data in the form of a variable? - Sergey
  • Write it in your variable $var = $APPLICATION->ShowViewContent('nav_page_count') - Nikolaj Sarry
  • This problem did not solve. Added screenshots. - Sergey

0