Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Bug or normal behavior? txp:newer/older for article, file, link lists
The problem: If I understand it correctly, txp:newer
and txp:older
are used both for articles pagination and for file/link lists pagination, using in those case the “pageby” attribute introduced in 4.3.0. I’m not sure about image index pagination, haven’t tried. BTW, when in a page template you have both an article tag and a txp:file_download_list
tag I can’t find a way to tell txp:newer
and txp:older
to paginate the file list, and not the article. In other words, when an article tag is there, txp:newer
and txp:older
seem to assume they have to work in the article context.
I raised this problem in this thread, and Els suggested me to write in Development forum. Please move in other category if it’s inappropriate.
What seems missing is a way to tell txp:newer
and txp:older
what kind of context (article, files, and I think also link) to consider when there are more than one of those kind of tags in the page.
In my case, I would happily dismiss the txp:article pgonly="1"
tag in the template, if I could. That would work fine with file list pagination, but txp insist on prompting me with an annoying “article tag missing” error message when I am in Debug or Test mode. Even if that error msg disappear when in Live mode, I have sometime to switch to Debug or Test when developing a new section for a live site. In that case, people visiting my page (even if I’m developing a different one) still see that error message, that is what I want to avoid. This is why I have to put txp:article pgonly="1"
somewhere in the page (as Els suggested, many kudos to her). So The pagination problem came up. I looked at the txp source code and it seems like a way to force context, or different set of tags for different context, may be a good addiction in future releases.
If you confirm that there are at the moment no other solution, I could wrap up a temporary plugin to solve my case. But maybe a native solution in the future would be better. If there are solutions, please point me in the right direction.
Offline
Re: Bug or normal behavior? txp:newer/older for article, file, link lists
Normal behaviour, I’m afraid.
TXP (currently) only has one ‘context’ at a time and the pagination is global. That is, as you have found, if you have more than one list on a page, the pagination affects them all.
But, two important changes occurred in 4.3.0:
- the annoying ‘no article tag’ warning only appears if article context is triggered (thanks go to Jeff for this behaviour)
- the context is set by whatever list tag occurs first on the page
Thus, in theory (I haven’t tested it to destruction but it seemed to work when I last tried it) if you put the <txp:article pgonly="1" />
after your <txp:file_download_list />
tag then it should trigger file context first and the warning will disappear. It will still “try” to paginate both lists at once, but if you have no actual articles on the page nobody will notice.
I agree that a way to force context might be useful. Some of the tags already allow this so it’s a logical extension. Although I’d probably prefer that pagination could be targeted to one of the types (default: article) so the various list flavours could be controlled independently with their own newer/older tags.
For now, please try switching your tag order and see if it helps.
Last edited by Bloke (2011-05-29 09:47:16)
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: Bug or normal behavior? txp:newer/older for article, file, link lists
Oh, yes! I didn’t know about the tag order. That does the job in my case, thanks Bloke.
Maybe that isn’t helpful if you need both articles and files in page and the order is important and can’t be switched. But That’s not my case now, so I’m living happy.
And, yes, I think that any kind of list should have their pagination tags working independently, too. Forcing the context for the same couple of tags is a viable solution, but I agree with your preference. I’m available to test any development solution, if that could help. Thanks again!
Offline