Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
?pg= variables missing from pagination
I must be missing something obvious. Trying to paginate article_custom which has a single filter by a custom field:
<txp:article_custom section="whatever" limit="50" sort="LastMod desc" status="live" price="sold" offset pageby>
Display articles here...
</txp:article_custom>
...
I’ve added this at the bottom to set the ‘total’:
<txp:pages total='<txp:article_custom section="whatever" limit="50" sort="LastMod desc" status="live" price="sold" pgonly />' />
Then I paste in the stock pagination bar code from example 3.
I get the correct number of links for all pages, as expected, but none of the links contain the ?pg=
variable. What am I missing?
Running stock Txp 4.8.8. Any ideas please?
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
Re: ?pg= variables missing from pagination
If you use this block in the individual article mode, it will not work in 4.8.8, since all txp params (except id
) are dropped. Dunno how to fix it, maybe via context
attribute? It seems to work in 4.9.
Offline
Re: ?pg= variables missing from pagination
etc wrote #337275:
If you use this block in the individual article mode, it will not work in 4.8.8, since all txp params (except
id
) are dropped. Dunno how to fix it, maybe viacontext
attribute? It seems to work in 4.9.
Ahhhh, the tags are inside an article. That must be why. Of course. Thank you. I’ll see if I can use context
but I think I tried it as a wrapper with txp:page_url and it didn’t work.
I’ll try again and play around. Thank you.
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
Re: ?pg= variables missing from pagination
Nope, didn’t work with a <txp:page_url context="pg">
wrapper. I guess pagination from an individual article context is a little bit of a strange concept. It just happens that this article contains the code to list all the sold item, which makes the URLs nice and consistent:
example.org/widgets/all => article that lists all available items
example.org/widgets/sold => article that lists all sold (unavailable) items
example.org/widgets/some-individual-widget => article all about that particular product
...
So what I did was just manually construct the URL and tack on the pg
variable by hand, on every newer/older link:
<a href="<txp:yield item="url" />?pg=<txp:yield item="page" />"
Seems to work fine. Thank you for the nudge towards a solution.
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
Re: ?pg= variables missing from pagination
I guess that has been deemed buggy (sorry) and patched in 4.9, so you’d better replace <txp:yield item="url" />
with something more stable, to avoid update issues.
Offline
Re: ?pg= variables missing from pagination
etc wrote #337290:
you’d better replace
<txp:yield item="url" />
with something more stable, to avoid update issues.
Umm, like….? <txp:item />
? Does that work in both 4.8 and 4.9?
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
Re: ?pg= variables missing from pagination
Maybe <txp:permlink />?pg=<txp:yield item="page" />
since you use it in an individual article context (and clean mode)? In 4.9 <txp:yield item="url" />
contains already pg
parameter, whatever context.
Offline
Re: ?pg= variables missing from pagination
Ah okay cool. I’ll switch to the permlink tag. Good call on the compatibility, thank you.
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