R
R
RobertDeGard2022-01-10 15:05:32
1C-Bitrix
RobertDeGard, 2022-01-10 15:05:32

How to remove the prefix page- from the page number?

Welcome all! Is it possible to somehow get rid of the prefix 'page-' from the page number in pagination?
For example, I now have a page of the form: /name-of-category/?page=page-1
And I need to bring it to this form: /name-of-category/?page=1

How pagination is implemented now: I
initialize the pagination class:

$pagination = new \Bitrix\Main\UI\PageNavigation("page");
  $pagination->allowAllRecords(true)
     ->setPageSize(4)
     ->initFromUri();

I get the elements using (Catalog - the symbolic API code for the infoblock):
\Bitrix\Iblock\Elements\ElementCatalogTable::getList();

And I output using the component:
$APPLICATION->IncludeComponent(
   "bitrix:main.pagenavigation",
   "",
   array(
      "NAV_OBJECT" => $pagination,
      "SEF_MODE" => "N",
   ),
   false
);


What I tried to do:
in urlrewrite I caught the page number using a regular expression (from such a url /name-of-category/?page=1), then I passed this page number to the method: class \Bitrix\Main\UI\PageNavigation. But it did not help. Can anyone suggest how to get rid of this 'page-' prefix?
addParams(Web\Uri $uri, $sef, $page, $size = null)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2022-01-12
@udjin123

Here Anton Dolganin well painted how to make a beautiful page in Bitrix 8 years ago, respectively, it is also suitable for your case, such an opportunity is mentioned there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question