Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2013-03-28 10:45:59

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: etc_pagination: paginate everything

Thanks Oleg! Looking great now – thanks for the instruction re the raw MySQL queries – its good to learn about this amazing little plugin you have written – thank you for that! There was no need to escape six\-innings – it didn’t work. six-innings was fine!

Offline

#26 2013-03-28 11:49:34

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

Re: etc_pagination: paginate everything

Glad you have it working, just call if something gets weird!

Slightly OT for devs: the first counting query would be unnecessary if <txp:article_custom /> supported pgonly attribute in some sense. For example, <txp:article_custom pgonly="numPages" /> could store the number of pages in <txp:variable name="numPages" />. I am not very hot about tight integration of article_custom pagination into etc_pagination, this would yield too much code replication.

Edit: or if <txp:article_custom pgonly="1" /> returned the number of pages…

Last edited by etc (2013-03-28 11:58:03)

Offline

#27 2013-03-30 16:08:39

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

Re: etc_pagination: paginate everything

Version 0.3.5: added new (undocumented, but self-explanatory) <txp:etc_numpages /> and <txp:etc_offset /> tags, to ease <txp:article_custom /> pagination. The problem above can be solved without etc_query now:

<!-- navigation bar -->
<txp:etc_pagination pgcounter="page"
	pages='<txp:etc_numpages section="news,blog,potw,six-innings" limit="5" />' />

<!-- display the appropriate page -->
<txp:article_custom section="news,blog,potw,six-innings" limit="5"
	offset='<txp:etc_offset pageby="5" pgcounter="page" />' />

You don’t need them for <txp:article /> pagination.

P.S. I still think that <txp:article_custom pgonly="1" /> would be better, so <txp:etc_numpages /> hopefully is only temporary solution.

Offline

#28 2013-03-31 00:52:30

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: etc_pagination: paginate everything

Great! I’ll give it a shot later and report back. Thanks Oleg!

Offline

#29 2013-03-31 08:41:51

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: etc_pagination: paginate everything

Ok Oleg – its working. Here’s what I had to do:

Page template:

<txp:article_custom section='<txp:if_section name="news">news,blog,potw,six-innings,photos<txp:else /><txp:section /></txp:if_section>' limit="10" offset='<txp:etc_offset pageby="10" pgcounter="page" />' form="news_list" />	

Pagination form:

<div id="newer-older" class="text-center">
	<txp:etc_pagination pgcounter="page" pages='<txp:etc_numpages section='<txp:if_section name="news">news,blog,potw,six-innings,photos<txp:else /><txp:section /></txp:if_section>' limit="10" />' prev="Previous" next="Next" range='<txp:adi_if_mobile>2<txp:else />10</txp:adi_if_mobile>' wraptag="" break="" />
</div>

Thanks a lot for this – much cleaner.

Offline

#30 2013-05-08 16:59:24

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,310

Re: etc_pagination: paginate everything

Hi Oleg,
I’m trying to create prev/next links for a txp:article tag, ordered by position (the stm_article_order DB column) and would expect to have chosen the easier one of the two article tags and be able to alter some attributes and in this way somehow get me there. But I’ve no luck: the two examples taken from the help output nothing although I’ve placed them in the same form that the native prev/next tags work in.
Please nudge me in the right direction. (TXP is 4.5.4, etc_pagination is v0.3.5)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#31 2013-05-09 16:56:29

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

Re: etc_pagination: paginate everything

Hi Uli,

You could try etc_link_to to replace link_to_prev/next tags. etc_pagination is not working in individual article mode, you can see it rather as enhanced txp:older/newer tag.

And as ever, if you only need to replace some attributes of existing tags, etc_query will do it nicely.

Offline

#32 2013-05-10 12:28:45

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,310

Re: etc_pagination: paginate everything

etc wrote:

etc_pagination is not working in individual article mode

D’oh, of course! Thanks, Oleg. I’ll post a comment on the etc_link_to page of your website.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#33 2013-09-22 17:36:55

robhert
Member
From: Perú
Registered: 2007-04-27
Posts: 206
Website

Re: etc_pagination: paginate everything

Hi! Thanks for this awesome plugin. I need some help:

Now I get this output

<ul class="pagination">
	<li><span data-rel="current">1</span></li>
	<li><a href="#">2</a></li>
	<li><a data-rel="next" rel="next" href="#">Next</a></li>
</ul>

but I need to style it differently, numbers and text. So I want this output:

<ul class="pagination">
	<li class="current"><span class="page-number">1</span></li>
	<li><a class="page-number button" href="#">2</a></li>
	<li><a class="page-next" href="#">Next</a></li>
</ul>

How could I achieve that?

Thank you in advance.

Offline

#34 2013-09-22 19:52:34

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

Re: etc_pagination: paginate everything

Thank you, most of it goes to ob1_pagination. I thought data-rel attributes would suffice for styling, but your question definitely makes sense. The current version is not flexible enough to produce such an output, but the (quickly tested, but unofficial) dev latest version is:

<txp:etc_pagination wraptag="ul" class="pagination" current="class='current'"
	link="<a class='page-number button' href='{href}'>{*}</a>,<span class='page-number'>{*}</span>"
	next="<a class='page-next' href='{href}'>Next</a>"
>
	<li {current}>{link}</li>
</txp:etc_pagination>

I have to test yet whether it is fully compatible with previous version, but it should be safe to use. If you don’t mind testing immature code, your feedback will be greatly appreciated.

Last edited by etc (2014-06-19 08:34:35)

Offline

#35 2013-09-23 13:38:07

robhert
Member
From: Perú
Registered: 2007-04-27
Posts: 206
Website

Re: etc_pagination: paginate everything

Thank you for your answer Oleg! And: It works perfectly!!!

I think it is much simpler to customize the output.

By the way: is it possible to do this:

<div class="pagination-info">Page 1 of 3</div>

Thank you for your time and help!

Last edited by robhert (2013-09-23 13:43:12)

Offline

#36 2013-09-23 18:56:37

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

Re: etc_pagination: paginate everything

robhert wrote:

By the way: is it possible to do this: <div class="pagination-info">Page 1 of 3</div>

Thanks for testing! For <txp:article /> pagination, you can try

link='<div class="pagination-info">Page {*} of <txp:php>global $thispage; echo $thispage["numPages"];</txp:php></div>'

This is not very practical, so I could introduce some {pages} placeholder in the next version, thank you for the suggestion. Meanwhile, you can simply add $replacements['{pages}'] = $numberOfTabs; right after the replacements array definition in the code, and call

link='<div class="pagination-info">Page {*} of {pages}</div>'

Offline

Board footer

Powered by FluxBB