Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#181 2017-01-12 10:09:04

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 251
Website

Re: etc_pagination: paginate everything

Hello, I’m using this with MLP, and in the news section of a website I’m seeing some three pages with no content. Es. Page 4 Page 5 Page 6 Page 7
I’m assuming that the <txp:variable name="numPages" value='<txp:etc_numpages pageby="10" />' /> is returning the whole count of the articles, but displaying only those that pertain to a specific language? Can I filter the articles by some language at the count stage?
Thank you

Offline

#182 2017-01-12 13:05:25

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

Re: etc_pagination: paginate everything

Sorry, I have no experience with MLP, but would presume that it sets internally the number of pages when you call <txp:article />. Have you tried to use <txp:etc_pagination /> without pages attribute?

Offline

#183 2017-03-17 09:18:38

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

I’ve implemented etc_pagination on my archive page, and wondering if I can jump to the month headers, as was possible by ID when they were all on one page (via the months links running down in the lavendar box column to the side — only works on the first page set now, of course).. Is there a way to do it with the pagination? or not so much? (It’s okay if the answer is that this is overly complex/impractical, this format is not particularly important to me and I can let it go if it’s not reasonably feasible :)


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#184 2017-03-17 10:11:57

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

Re: etc_pagination: paginate everything

Amazing site :-) But tell me, clicking on November 2007 should take me to pg=4 or pg=3?

Offline

#185 2017-03-17 10:47:34

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

=’_’= I figure it would go to the first mention of the date; so would be pg=3. Is this practical to try? Or I’m over-complicating the structure?


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#186 2017-03-17 11:45:27

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

Re: etc_pagination: paginate everything

alicson wrote #304843:

Or I’m over-complicating the structure?

You do, but I like challenges. etc_pagination has no idea of what it paginates, but you can generate the lavender month headers list with etc_query, adapting the following to your needs:

<txp:etc_query data="SELECT DATE_FORMAT(Posted, '%Y-%m') AS month, COUNT(*) AS count FROM `textpattern` GROUP BY month" wraptag="ul" break="li">
{$(month?).date(F Y)} ({count?} articles) is on page {$/({!counter}|3).intval.+1} (with 3 articles by page)
<txp:variable name="counter" value="{$+({!counter}|{count?})}" />
</txp:etc_query>

Offline

#187 2017-03-17 13:43:57

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

Thank you!! Am working with this… I’m learning the syntax though — could you please clue me: how do I reverse the order, so that it’s date descending (currently ascending).

*update: got it! (that part of it at least :) moving forward…

Last edited by alicson (2017-03-17 13:50:52)


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#188 2017-03-17 14:17:43

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

Okay so I think I’m close… Where do I place/what’s the syntax for me to specify which sections to include in the query? (section=“journal,briefs,about,words”)
Once I have that I think it’ll be good to go..!


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#189 2017-03-17 14:26:35

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

This does not appear to be it.. (close…no cigar)

<txp:variable name="numPgs"><txp:etc_numpages section="journal,briefs,about,words" pageby="200" /></txp:variable>
<txp:etc_query data="SELECT DATE_FORMAT(Posted, '%Y-%m') AS month,
COUNT(*) AS count FROM `textpattern` where (section like 'journal' or section like 'briefs' or section like 'about' or section like 'words') GROUP BY month ORDER BY `posted` DESC" wraptag="ul" break="li">
<a href="/archivebydate?id=&s=archivebydate&c=&pg={$/({!counter}|200).intval.+1}#{$(month?).date(Ym)}">{$(month?).date(F Y)}</a> <span class="note">({count?})</span>
<txp:variable name="counter" value="{$+({!counter}|{count?})}" />
</txp:etc_query>

textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#190 2017-03-17 14:44:33

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

Re: etc_pagination: paginate everything

Maybe Section, not section:

<txp:etc_query data="SELECT DATE_FORMAT(Posted, '%Y-%m') AS month,
COUNT(*) AS count FROM `textpattern` where FIND_IN_SET(Section , 'journal,briefs,about,words') AND Status = 4 GROUP BY month ORDER BY month DESC" wraptag="ul" break="li">
    <a href="/archivebydate?id=&s=archivebydate&c=&pg={$/({!counter}|200).intval.+1}#{$(month?).date(Ym)}">{$(month?).date(F Y)}</a> <span class="note">({count?})</span>
    <txp:variable name="counter" value="{$+({!counter}|{count?})}" />
</txp:etc_query>

I have added Status = 4 to only count live articles. If you have future|expired articles, you’ll need to add few more things.

Offline

#191 2017-03-17 15:27:40

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

We win!! o^_^o

Very much thank you. I’m learning a lot also through all this implementation.


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#192 2017-03-20 08:23:27

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

How may etc_cache and etc_pagination play together? :) (Wrapping my date archives in etc_cache basically freezes pagination so that nothing other than the first page ever loads.)


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

Board footer

Powered by FluxBB