Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[Solved] Pagination problem
Is there a problem with the breakby
in use into an <txp:article />
tag and the new pagination feature into a default
template?
I finished my latest project but I can’t implement such a kind of pagination (but required to navigate thought the pages and the different article lists)
Last edited by Pat64 (2020-08-24 04:39:12)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: [Solved] Pagination problem
I don’t know. Please share your relevant code here so we can test/debug.
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: [Solved] Pagination problem
Sure! Thank you Stef.
Into my default
page:
<txp:variable name="time" trim><txp:if_section name="prochainement">future<txp:else />past</txp:if_section></txp:variable>
<txp:if_section name=",catalogue-general">
<txp:article break="div" breakclass="full table table-fixed flex mt0" breakby="3" searchall="0" sort="Posted asc" time='<txp:variable name="time" trim />' limit="3">
<txp::books_list />
</txp:article>
Note: the variable is here to test some articles with a future date (all articles are associated with the “catalogue-general” section).
And here is the books_list
form:
<div class="_1/0 ie7-hide"> </div>
<div class="_1/3 table-cell inner-centered rel flex mb2em card no-select">
<article class="_inner rel txt-c">
<a rel="bookmark" href="<txp:permlink />" class="vertical-txt">
<h2 class="txt-c font-large mt0 mb0"><txp:title trim="/(.*)(@\s)(\w+\s?\w+)(\s\(\d+\))?/" replace='«$1» <br><em class="nwf #888-color">$3</em>' /></h2></a>
<a href="<txp:permlink />" aria-hidden="true" tabindex="-1" class="bk-wrapper">
<div class="rel book bk:hover">
<span class="bk-front"></span>
<div class="bk-cover">
<div class="abs z-1 excerpt">
<txp:excerpt />
</div>
<txp:if_article_image>
<picture class="protect">
<txp:images>
<source media="(max-width:576px)" srcset="<txp:smd_thumbnail type="small" display="url" id='<txp:image_info type="id" />' form="img_srcset" />">
<source media="(max-width:922px)" srcset="<txp:smd_thumbnail type="medium" display="url" id='<txp:image_info type="id" />' form="img_srcset" />">
<source media="(min-width:923px)" srcset="<txp:smd_thumbnail type="large" display="url" id='<txp:image_info type="id" />' form="img_srcset" />">
<img src="<txp:smd_thumbnail type="large" display="url" id='<txp:image_info type="id" />' />" loading="lazy" alt="<txp:image_info type="alt" />" width="358" height="515" />
</txp:images>
<txp:else />
<picture class="placeholder">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP89R8AAvkB+0p/ESEAAAAASUVORK5CYII=" loading="lazy" alt="non disponible" width="358" height="515" aria-hidden="true" tabindex="-1" />
</txp:if_article_image>
</picture>
</div>
<span class="page z-1"></span>
</div>
</a>
<p class="mt2em txt-c"><a href="<txp:permlink />" aria-hidden="true" tabindex="-1" class="btn #33e-bg fs120% :hover"><svg role="img" aria-label="Découvrir" aria-hidden="true" focusable="false" width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><switch><g><path d="M16.172 11l-5.364-5.364 1.414-1.414L20 12l-7.778 7.778-1.414-1.414L16.172 13H4v-2z" fill="currentColor"></path></g><foreignObject width="0" height="0" overflow="hidden">→</foreignObject></switch></svg> Découvrir</a></p>
</article>
</div>
<div class="_1/0 ie7-hide"> </div>
I tried to add a pagination form into the default
page without any good results…
<div class="full mt2em txt-c">
<div aria-label="Page navigation" class="pagination mt2em">
<ul class="list-inline no-list pagination">
<txp:pages pg="pg" evaluate="5,2,8,4,6">
<txp:newer shift="1" break="li" showalways><span aria-label="Vers la page précédente" class="btn trans"><svg role="img" aria-label="Précédent" aria-hidden="true" focusable="false" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><switch><g><path fill-rule="evenodd" d="M7.854 4.646a.5.5 0 0 1 0 .708L5.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0z"></path><path fill-rule="evenodd" d="M4.5 8a.5.5 0 0 1 .5-.5h6.5a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5z"></path></g><foreignObject width="0" height="0" overflow="hidden"><i class="icon">←</i></foreignObject></switch></svg> Précédente</span></txp:newer>
<txp:newer shift break="li"><span aria-label="Vers la première page" class="btn trans #f9f-bg">Première page</span></txp:newer>
<txp:hide process="2"><txp:newer shift="-2" link="" break="li"><span role="separator" aria-label="Autres pages" class="btn trans disabled">...</span></txp:newer></txp:hide>
<txp:newer shift="2,1" break="li"><span aria-label="Vers la page <txp:yield item="page" />" class="btn trans #f9f-bg">Page <txp:yield item="page" /></span></txp:newer>
<txp:newer shift="0" link=""><li><span aria-label="Page courante" class="btn trans disabled #f9f-bg">Page <txp:yield item="page" /></span></li></txp:newer>
<txp:older shift="1,2" break="li"><span aria-label="Vers la page <txp:yield item="page" />" class="btn trans #f9f-bg">Page <txp:yield item="page" /></span></txp:older>
<txp:hide process="2"><txp:older shift="-2" link="" break="li"><span role="separator" aria-label="Autres pages" class="btn trans disabled">...</span></txp:older></txp:hide>
<txp:older shift break="li"><span aria-label="Vers la dernière page" class="btn trans #f9f-bg">Dernière Page</span></txp:older>
<txp:older shift="1" break="li" showalways><span aria-label="Vers la page suivante" class="btn trans">Suivante <svg role="img" aria-label="Suivant" aria-hidden="true" focusable="false" width="12" height="12" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><switch><g><path d="M16.172 11l-5.364-5.364 1.414-1.414L20 12l-7.778 7.778-1.414-1.414L16.172 13H4v-2z" fill="currentColor"></path></g><foreignObject width="0" height="0" overflow="hidden"><i class="icon">→</i></foreignObject></switch></svg></span></txp:older>
</ul>
</txp:pages>
</div>
</div>
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: [Solved] Pagination problem
Thanks for the code. Won’t limit="3"
cut off your articles after the 3rd one, rendering pagination useless?
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: [Solved] Pagination problem
I want to repeat each group of 3 articles, then display the pagination for the other pages.
I tried to remove the limit
attribute but without any effects (except “Page 1”)…
Last edited by Pat64 (2020-07-24 11:12:25)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: [Solved] Pagination problem
Ok.
I found and located my problem! 😋
My fault in adding this code into my doctype
form: 😱
<txp:article pageby pgonly>
<meta name="robots" content="<txp:if_expires>unavailable_after: <txp:expires gmt format="%d-%b-%y %T" /> GMT<txp:else />index,follow,noodp,noydir</txp:if_expires>">
<meta name="googlebot" content="<txp:if_expires>unavailable_after: <txp:expires gmt format="%d-%b-%y %T" /> GMT<txp:else />index,follow,noodp,noydir</txp:if_expires>">
</txp:article>
What could you suggest me as a fallback and best practice in order to use limited time meta
tags for expired articles?
Last edited by Pat64 (2020-07-25 05:49:50)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: [Solved] Pagination problem
FWIW, breakby
has nothing to do with the pagination, it just groups the articles of the current page to be separated by break
.
Pat64 wrote #324834:
What could you suggest me as a fallback and best practice in order to use limited time
meta
tags for expired articles?
Since <txp:if_expires />
tag can only be used in article context, why not
<txp:if_individual_article>
<meta name="robots" content="<txp:if_expires>unavailable_after: <txp:expires gmt format="%d-%b-%y %T" /> GMT<txp:else />index,follow,noodp,noydir</txp:if_expires>">
<meta name="googlebot" content="<txp:if_expires>unavailable_after: <txp:expires gmt format="%d-%b-%y %T" /> GMT<txp:else />index,follow,noodp,noydir</txp:if_expires>">
</txp:if_individual_article>
Offline
Re: [Solved] Pagination problem
😀
<txp:if_individual_article>...</txp:if_individual_article>
Some obvious are too obvious for me.
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: [Solved] Pagination problem
I encounter a problem with my pagination which display 2 exceed blank pages:
<txp:variable name="pages" trim>
<txp:pages total shift="3" break="li"><span aria-label="Go to page" class="btn trans #f9f-bg"><txp:yield item="page" /></span></txp:pages>
</txp:variable>
<div class="full mt2em mb4em txt-c">
<nav aria-label="Page navigation" class="pagination">
<ul class="list-inline no-list table mxa">
<li class="inline"><txp:newer rel="prev" showalways><span aria-label="Go to previous page" class="btn trans"><svg role="img" aria-label="Previous" aria-hidden="true" focusable="false" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><switch><g><path fill-rule="evenodd" d="M7.854 4.646a.5.5 0 0 1 0 .708L5.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0z"></path><path fill-rule="evenodd" d="M4.5 8a.5.5 0 0 1 .5-.5h6.5a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5z"></path></g><foreignObject width="0" height="0" overflow="hidden"><i class="icon">←</i></foreignObject></switch></svg> Previous</span></txp:newer></li>
<txp:newer rel="prev" shift showalways><li class="inline"><span aria-label="Go to first page" class="btn trans #f9f-bg">First page</span></li></txp:newer>
<txp:newer rel="next" shift="-2" link=""><li class="inline"><span role="separator" aria-label="Other pages" class="btn trans disabled">...</span></li></txp:newer>
<txp:variable name="pages" />
<txp:older shift="-2" link=""><li class="inline"><span role="separator" aria-label="Other pages" class="btn trans disabled">...</span></li></txp:older>
<li class="inline"><txp:older rel="next" shift showalways><span aria-label="Go to last page" class="btn trans #f9f-bg">Last Page</span></txp:older></li>
<li class="inline"><txp:older rel="next" showalways><span aria-label="Go to next page" class="btn trans">Suivante <svg role="img" aria-label="Next" aria-hidden="true" focusable="false" width="12" height="12" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><switch><g><path d="M16.172 11l-5.364-5.364 1.414-1.414L20 12l-7.778 7.778-1.414-1.414L16.172 13H4v-2z" fill="currentColor"></path></g><foreignObject width="0" height="0" overflow="hidden"><i class="icon">→</i></foreignObject></switch></svg></span></txp:older></li>
</ul>
</nav>
</div>
Could you tell me what is governing the number indicators for each page.
Last edited by Pat64 (2020-08-10 05:42:29)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: [Solved] Pagination problem
Pat64 wrote #325270:
I encounter a problem with my pagination which display 2 exceed blank pages…
Hi Patrick,
I’m by no means pretending that I can see where the problem might be, but had a similar issue which was due to db indexing, and solved by running wet_haystack. (Back-up before using it as it has not been tested with later txp versions).
ps. Heads-up: your site is down
pps. Lots of sites seem to be having an issue lately:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: [Solved] Pagination problem
Hi Yiannis.
Thank you lot for your reply.
With the help of the wet_haystack plugin: on which column do you apply a reindexation (I tried first to use phpMyAdmin to make some tables optimisation but without any success)?
P.S. don’t worry with my website (and all other): I’m encuring many host problems (after the compagny hab been sold); I project to change the provider but I had no time for the moment…
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: [Solved] Pagination problem
Hi Patrick,
When I did it, I just left the default columns as initially selected by haystack.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline