A
A
Alexander Pankov2015-02-04 10:54:50
MODX
Alexander Pankov, 2015-02-04 10:54:50

How to organize pagination on MODX?

Hello, please tell me what I'm not doing wrong when I try to build pagination.

[[pdoResources? 
    &limit=`0`
    &depth=`1` 
    &includeTVs=`imageUsluga` 
    &parents=`2` 
    &includeContent=`1` 
    &tpl=`uslugiTpl` 
    &sortby=`publishedon` 
    &sortdir=`DESC` ]]

I display resources on the page (I have 8 of them), everything is ok!
But now, I want not all resources to be displayed, but, for example, 2 pieces and with pagination.
So I do:
[[pdoPage?
        &tpl=`@INLINE <p>[[+idx]] <a href="/[[+uri]]">[[+pagetitle]]</a></p>`
        &limit = `2`
    ]]
    [[+page.nav]] 
    [[+pageCount]]

I have 4 links displayed (logically limit = 2, and resources 8 = 4 pages)
BUT these links lead ?page=NUMBER, but nothing happens, EVEN INITIALLY and when I click on the link, I still see all 8 of my resources, like if pagination is visible, but it doesn’t work, what am I doing wrong??
and yes, it outputs something strange.... the
d2cfea8d85d9.png
last 4 is [[+pageCount]], but the first "Service 3"... where they came from..
Thank you in advance for your help

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
P
Pavel Myshkin, 2015-02-04
@Pazys

[[!pdoPage?
    &cache=`1`
    &cacheTime=`1800`
]]
[[!+page.nav]]

This is how the cache in these snippets should be used. That is, to call non-cached [[! and use their internal cache management mechanism.

A
Alexander Pankov, 2015-02-04
@PankovAlxndr

Somehow it's strange, I combined pdoResources and pdoPage and it worked, somehow strange and wrong, this chunk broke in other places now .... :c

[[!pdoPage?
    	&limit=`4`
    	&tpl=`uslugiTpl`
    	&includeTVs=`imageUsluga`
    	&includeContent=`1`
    ]]
    <div class='pagination'>[[!+page.nav]]</div>

B
biper111, 2021-05-12
@biper111

Site on Modx revo. Pagination via [[!+page.nav]]. After connecting SEOPro, oddities began ...
Pagination does not work if, when switching from https://petrovich-design.ru/web-design , I scroll to the next page, the system substitutes the address of the section in the path to the resource once again in the form https://petrovich- design.ru/ web-dizajn /web-dizajn/?page=2
If we remove the repetition of the section, then the URL of the form https://petrovich-design.ru/web-dizajn/?page=2 opens page 2 as expected ...
T. e. it turns out that the navigation tries to duplicate the section alias and substitutes it in the URL as a nested link, although "nested URLs" are disabled in the system ...
How to remove it from there someone is stupid ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question