Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-12-03 19:19:56

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Article list page numbers

I’d like to label article listings with ‘page x of y’. I am aware of soo_page_numbers and if the planets are in alignment I could likely use etc_query to do, well, anything – is there a method in core, perhaps using article in some fashion, that can do the numbering?

Last edited by gaekwad (2013-12-03 19:20:16)

Offline

#2 2013-12-03 19:35:40

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: Article list page numbers

Page <txp:page_url type="pg" /> of <txp:php>global $thispage; if(!empty($thispage)) echo 'Page ', $thispage['pg'], ' of ', $thispage['numPages'];</txp:php>?

Last edited by etc (2013-12-03 19:38:35)

Offline

#3 2013-12-03 19:56:16

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Re: Article list page numbers

etc wrote:

<txp:php>global $thispage; if(!empty($thispage)) echo 'Page ', $thispage['pg'], ' of ', $thispage['numPages'];</txp:php>?

That works, you magnificent man. Thank you so much.

Last edited by gaekwad (2013-12-03 19:56:23)

Offline

#4 2013-12-03 20:45:38

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: Article list page numbers

You are very welcome, gentle sir! To complete the tableau, in etc_query-ish it would be

<txp:etc_query globals="thispage" data="Page {?pg} of {?numPages}" />,

but actually it’s more etc_pagination job:

<txp:etc_pagination range="0">
	Page {*} of {pages}
</txp:etc_pagination>

Offline

#5 2013-12-03 21:16:02

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Re: Article list page numbers

I didn’t even know there was an etc_pagination. Now I do. Please consider me appropriately humbled and grateful.

Offline

Board footer

Powered by FluxBB