Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

etc
Developer
Registered: 2010-11-11
Posts: 3,145
Website

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.


etc_[ query | search | pagination | date | tree | cache ]

Offline

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

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

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: 198
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: 3,145
Website

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)


etc_[ query | search | pagination | date | tree | cache ]

Offline

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

robhert
Member
From: Perú
Registered: 2007-04-27
Posts: 198
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: 3,145
Website

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>'

etc_[ query | search | pagination | date | tree | cache ]

Offline

#37 2013-09-23 19:43:57

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

Re: etc_pagination: paginate everything

Hi Oleg! First, thank you for your time.

I added in the line 124 this:

$replacements['{pages}'] = $numberOfTabs;

In context:

$replacements['{link}'] = strtr($last ? $last : $link, $replacements);
$replacements['{pages}'] = $numberOfTabs;
if($gap2 && $loopEnd < $numberOfTabs) 

And I put this on my page:

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

And I got this:

<span data-rel="current"><div class="pagination-info">Page 1 of {pages}</div></span>
<a href="?q=hi&pg=2"><div class="pagination-info">Page 2 of {pages}</div></a>

Any idea? Did I made something wrong?

Thank you in advance.

EDIT 1: Tried the other code

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

But get this:

<span data-rel="current"><div class="pagination-info">Page 1 of 2</div></span>
<a href="?q=hi&amp;pg=2" rel="" data-rel=""><div class="pagination-info">Page 2 of 2</div></a>

Last edited by robhert (2013-09-23 19:48:40)

Offline

#38 2013-09-23 19:58:02

etc
Developer
Registered: 2010-11-11
Posts: 3,145
Website

Re: etc_pagination: paginate everything

Hi Robhert,

line 124 is too late, add this code after l. 36. For the rest, that’s what I meant by testing the compatibility with the previous version. :) Could you try this:

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

or even

<txp:etc_pagination>
	<div class="pagination-info">Page {*} of {pages}</div>
</txp:etc_pagination>

Edit: well, we’ll have to do something with the current page. What is working now is:

<txp:etc_pagination link='<div class="pagination-info">Page {*} of {pages}</div>' current='<div class="pagination-info">Page {*} of {pages}</div>' active="1">
	{link}
</txp:etc_pagination>

but it’s too heavy.

Last edited by etc (2013-09-23 20:08:06)


etc_[ query | search | pagination | date | tree | cache ]

Offline

#39 2013-09-23 22:05:21

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

Re: etc_pagination: paginate everything

Hi Oleg! It didn’t work. And I think the plugin is fine in what it does: paginating articles.

BTW, I found a TXP plugin what does what I need: rsx_page_number

Thank you very much for your help and time!

Offline

#40 2013-09-24 09:06:08

etc
Developer
Registered: 2010-11-11
Posts: 3,145
Website

Re: etc_pagination: paginate everything

robhert wrote:

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

Sorry, Robhert, I guess I have misunderstood your question. If you want to output the current page number separately from the nav list, this should do:

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

It will work only for <txp:article /> pagination, so I should probably add few new tags to etc_pagination to enable it in other lists.

Edit: ok, quickly implemented in dev version now, please test:

<div class="pagination-info">Page <txp:etc_offset type="counter" /> of <txp:etc_numpages /></div>

Last edited by etc (2013-09-24 09:25:51)


etc_[ query | search | pagination | date | tree | cache ]

Offline

Board footer

Powered by FluxBB