Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-11-14 17:18:52

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,911
Website

count the number of pages

For a new blog section I am creating, I use the code below (thanks Oleg!).

My question is if there is a way to count how many pages there are.

ie. I would like to change <span><span>Page <txp:page_url type="pg" /></span><txp:page_url type="pg" /></span> to <span><txp:page_url type="pg" />/xxx pages</span> pages

<txp:evaluate test="older, newer" wraptag="nav" class="centre">
    <txp:older wraptag="span">Older</txp:older>
    <span>Page <txp:page_url type="pg" /></span>
    <txp:newer wraptag="span">Newer</txp:newer>
</txp:evaluate>

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#2 2018-11-14 18:59:25

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: count the number of pages

It does not seem to be exposed via tags, so

<txp:php>
global $thispage;
echo empty($thispage['numPages']) ? "None" : $thispage['numPages'];
</txp:php>

etc_[ query | search | pagination | date | tree | cache ]

Offline

#3 2018-11-14 20:13:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,911
Website

Re: count the number of pages

This actually works!!! Thanks so much Oleg.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#4 2018-11-14 20:53:44

etc
Developer
Registered: 2010-11-11
Posts: 2,949
Website

Re: count the number of pages

colak wrote #315238:

This actually works!!! Thanks so much Oleg.

Glad it helps, Yiannis, I’m the first surprised! :-)

Edit: but I don’t see why it couldn’t be output via a tag, there is no secret in the number of pages.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#5 2018-11-15 06:22:20

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,911
Website

Re: count the number of pages

etc wrote #315242:

Edit: but I don’t see why it couldn’t be output via a tag, there is no secret in the number of pages.

indeed. Now that we can count articles using txp tags, there should be a way to count evrything else.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#6 2018-11-15 09:04:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,458
Website

Re: count the number of pages

etc wrote #315242:

I don’t see why it couldn’t be output via a tag, there is no secret in the number of pages.

Yes, it’s exposed in the globals, just not via tag. We could do pagination better. Anything from this thread worth salvaging or revisiting?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2018-11-15 16:39:32

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,911
Website

Re: count the number of pages

Bloke wrote #315251:

Yes, it’s exposed in the globals, just not via tag. We could do pagination better. Anything from this thread worth salvaging or revisiting?

I would love to have the ob1_googlenav functionality in the core. Although I type the page number I want to go to in the address bar, I know many people who would click the next link every time.

here is the plugin for txp v 4.4.1

YToxMDp7czo0OiJuYW1lIjtzOjEzOiJvYjFfZ29vZ2xlbmF2IjtzOjY6ImF1dGhvciI7czoxOToiSGVucmlrIEomb3VtbDtuc3NvbiI7czoxMDoiYXV0aG9yX3VyaSI7czoyNToiaHR0cDovL3Jpc2UubGV3YW5kZXIuY29tLyI7czo3OiJ2ZXJzaW9uIjtzOjM6IjIuMCI7czoxMToiZGVzY3JpcHRpb24iO3M6NDI6IkNyZWF0ZXMgYSBHb29nbGUgaW5zcGlyZWQgcGFnZSBuYXZpZ2F0aW9uLiI7czo0OiJoZWxwIjtzOjUyMTM6Ijx1bD4KCTxsaT48YSBocmVmPSIjcGx1Z2luU3VtbWFyeSI+U3VtbWFyeTwvYT48L2xpPgoJCTxsaT48YSBocmVmPSIjcGx1Z2luQXR0cmlidXRlcyI+QXR0cmlidXRlczwvYT4KCTx1bD4KCTxsaT48YSBocmVmPSIjcGx1Z2luVGFiTWF4Ij50YWJtYXg8L2E+PC9saT4KCQk8bGk+PGEgaHJlZj0iI3BsdWdpbkxpbmtDdXJyZW50Ij5saW5rY3VycmVudDwvYT48L2xpPgoJCTxsaT48YSBocmVmPSIjcGx1Z2luT3V0cHV0TGFzdEZpcnN0Ij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PC91bD5cbiI7DQoNCgkJcmV0dXJuIGpvaW4oIiIsICRvdXQpOw0KDQoJfWVsc2V7DQoNCgkJcmV0dXJuICIiOw0KDQoJfQ0KDQp9IjtzOjQ6InR5cGUiO3M6MToiMCI7czo1OiJvcmRlciI7czoxOiI1IjtzOjM6Im1kNSI7czozMjoiZjVmYTU4MTE3MzVhMGRjOTAyZmJmMDk5OWE1MTVkNzUiO30=

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#8 2018-11-15 17:04:51

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,159
Website

Re: count the number of pages

etc_pagination (and here, (latest?) compiled plugin here) will do you numbered pagination in various permutations and works reliably.

Bloke wrote #315251:

Anything from this thread worth salvaging or revisiting?

Yes!!


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB