Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-05-27 05:28:45

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,076
Website

[solved] current page item in complex pagination not displayed

TXP dev – 4.8.1 running on localhost

the current page item in a complex pagination fails to display. the code to generate it doesn’t do anything. More exactly, this part returns blank:

<txp:newer shift="0" link=""><li class="current-page"><b title="Current page" aria-current="page"><txp:yield item="page" /></b></li></txp:newer>

the code I am using is a minor variant on the code in this thread.

It used to work on my test set up when the concept was first discussed here. AFAIK, nothing changed except for updated TXP code.

Full code below

<txp:pages pg="pg" evaluate="5,2,8,4,6">
  <nav aria-label="navigation" class="pagination"><span>Pages: </span>
    <ul class="list-pagination">
      <txp:newer shift="1" break="li" showalways><span aria-label="Go to previous page">Previous</span></txp:newer>
      <txp:newer shift break="li"><span aria-label="Go to first page"><txp:yield item="page" /></span></txp:newer>
      <txp:evaluate test="newer"><li class="separator"><txp:newer shift="-2" link="" break=""><span role="separator" aria-label="More pages">...</span></txp:newer></li></txp:evaluate>
      <txp:newer shift="2,1" break="li"><span aria-label="Go to page <txp:yield item="page" />"><txp:yield item="page" /></span></txp:newer>
      <txp:newer shift="0" link=""><li class="current-page"><b aria-current="page"><txp:yield item="page" /></b></li></txp:newer>
      <txp:older shift="1,2" break="li"><span aria-label="Go to page <txp:yield item="page" />"><txp:yield item="page" /></span></txp:older>
      <txp:evaluate test="older"><li class="separator"><txp:older shift="-2" link="" break=""><span role="separator" aria-label="More pages">...</span></txp:older></li></txp:evaluate>
      <txp:older shift break="li"><span aria-label="Go to last page"><txp:yield item="page" /></span></txp:older>
      <txp:older shift="1" break="li" showalways><span aria-label="Go to next page">Next</span></txp:older>
    <ul>
  </nav>
</txp:pages>

The code is used on a set of list pages with a very basic structure, just a list of articles; that part displays fine. There are enough articles in that section to generate a dozen pages

<txp:article form="pw_article_list" limit="8" sort="Posted desc" allowoverride="0" wraptag="div" break="article" class="archive-list article-list" />

Last edited by phiw13 (2020-05-29 07:44:35)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#2 2020-05-27 08:33:05

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

Re: [solved] current page item in complex pagination not displayed

This shift="0" has stopped working before 4.8 release, I don’t remember the reason. Try this code?

Offline

#3 2020-05-27 08:41:41

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,076
Website

Re: [solved] current page item in complex pagination not displayed

etc wrote #323318:

This shift="0" has stopped working before 4.8 release, I don’t remember the reason. Try this code?

Yes sir!
substituting the one offending line in my code above with this:

<txp:pages><li class="current-page"><b title="Current page" aria-current="page"><txp:yield item="page" /></b></li></txp:pages>

makes it work as expected. cool. Thanks a lot.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#4 2020-05-27 13:16:26

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: [solved] current page item in complex pagination not displayed

FYI I’ve been coding up a core pagination solution for Textpattern.com being helped by Oleg and also some of Michael’s code. There’s couple of additional bits we have done for that so I’ll post the final code here later, which you might find useful.

Offline

#5 2020-05-27 14:19:22

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: [solved] current page item in complex pagination not displayed

Regarding the original topic of this page – after some investigation the issue arises between Textpattern 4.8.0 and changes made in 4.8.1. Basically in 4.8.0 use this for generating the current page:

<txp:newer shift="0" link=""><li class="current-page"><b title="Current page" aria-current="page"><txp:yield item="page" /></b></li></txp:newer>

And in 4.8.1 use this:

<txp:pages><li class="current-page"><b title="Current page" aria-current="page"><txp:yield item="page" /></b></li></txp:pages>

Offline

#6 2020-05-29 07:46:19

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,076
Website

Re: [solved] current page item in complex pagination not displayed

Oleg has patched the TXP codebase, with some bug fixes and improvements, see the original thread for the currently well working example.

edit – me need a new set of eyes

Last edited by phiw13 (2020-05-29 07:48:07)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#7 2020-05-29 15:32:57

singaz
Member
Registered: 2017-03-12
Posts: 150

Re: [solved] current page item in complex pagination not displayed

My experiment is in 4.8.0. The code is from here , so that when updating the engine to 4.8.1, do not change the code again. Changed li to span.

<txp:pages pg showalways="2" evaluate="5,2,8,4,6">
    <nav class="posts-navigation" aria-label="Blog navigation">
        Pages:
        <txp:newer showalways link=""><a rel="prev" href="<txp:yield item="url" />" title="Go to previous page" aria-label="Go to previous page">Previous</a></txp:newer>
            <txp:newer shift link=""><span><a href="<txp:yield item="url" />" title="Go to page <txp:yield item="page" />" aria-label="Go to page <txp:yield item="page" />"><txp:yield item="page" /></a></span></txp:newer>
            <txp:newer shift="-2" link=""><span role="separator" title="More pages" aria-label="More pages">…</span></txp:newer>
            <txp:newer total shift="2" link=""><span><a href="<txp:yield item="url" />" title="Go to page <txp:yield item="page" />" aria-label="Go to page <txp:yield item="page" />"><txp:yield item="page" /></a></span></txp:newer>
            <txp:pages><span class="current"><b title="Current page" aria-current="page"><txp:yield item="page" /></b></span></txp:pages>
            <txp:older total shift="2" link=""><span><a href="<txp:yield item="url" />" title="Go to page <txp:yield item="page" />" aria-label="Go to page <txp:yield item="page" />"><txp:yield item="page" /></a></span></txp:older>
            <txp:older shift="-2" link=""><span role="separator" title="More pages" aria-label="More pages">…</span></txp:older>
            <txp:older shift link=""><span><a href="<txp:yield item="url" />" title="Go to page <txp:yield item="page" /> (last page)" aria-label="Go to page <txp:yield item="page" /> (last page)"><txp:yield item="page" /></a></span></txp:older>
        <txp:older showalways link=""><a rel="next" href="<txp:yield item="url" />" title="Go to next page" aria-label="Go to next page">Next</a></txp:older>
    </nav>
</txp:pages>

So displayed:

Perhaps because I have a poor understanding of how the new <txp:newer>/<txp:older> and <txp:pages> work.

Last edited by singaz (2020-05-29 15:34:54)


Sorry my horror English. I’m learning textpattern, I’m learning English

Offline

#8 2020-05-29 15:50:51

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

Re: [solved] current page item in complex pagination not displayed

You have to use <txp:newer shift="0" /> instead of <txp:pages /> in 4.8. Both will work in 4.8.1, sorry for the hassle.

Offline

#9 2020-05-29 16:39:01

singaz
Member
Registered: 2017-03-12
Posts: 150

Re: [solved] current page item in complex pagination not displayed

It is Ok, thank you!

Last edited by singaz (2020-05-29 19:05:39)


Sorry my horror English. I’m learning textpattern, I’m learning English

Offline

Board footer

Powered by FluxBB