Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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&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
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)
Offline
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
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)
Offline
Re: etc_pagination: paginate everything
It works!!!
Your plugin is awesome! I’ve installed the dev_version and added <div class="pagination-info">Page <txp:etc_offset type="counter" /> of <txp:etc_numpages /></div>
to my code and the output is <div class="pagination-info">Page 1 of 3</div>
.
Thank you Oleg!
Last edited by robhert (2013-09-24 14:52:57)
Offline
Re: etc_pagination: paginate everything
Version 0.4 released as beta for the moment, more functional and flexible, please welcome. It incorporates Robhert’s suggestions and more, but is not fully compatible with v.0.3, so test before use. For example, the output above can be obtained with
<txp:etc_pagination range="0">
<div class="pagination-info">Page {*} of {pages}</div>
</txp:etc_pagination>
Last edited by etc (2013-10-02 09:44:53)
Offline
Re: etc_pagination: paginate everything
Hi Oleg!
It seems this code won’t work with the newest version of your plugin because there is no active
tag.
<txp:etc_pagination wraptag="ul" class="pagination" active="class='current'" link="<a class='page-number button' href='{href}'>{*}</a>" current="<span class='page-number'>{*}</span>" next="<a class='page-next' href='{href}'>Next</a>">
<li {active}>{link}</li>
</txp:etc_pagination>
What I need is this
<span class='current'>1</span>
<a href='#' class='page larger'>2</a>
<a href='#' class='nextpostslink'>»</a>
But I don’t know how to get that ouput. I tried many times, and the only code that partially works is this:
<txp:etc_pagination link="<a class='page larger' href='{href}'>{*}</a>" current="<span class='current'>{*}</span>" prev="<a class='prevpostslink' href='{href}'>«</a>" next="<a class='nextpostslink' href='{href}'>»</a>">
{link}
</txp:etc_pagination>
Works, but there is no current page selection (All links are active).
Could you give me a hand with this?
Thank you very much.
Robhert
Offline
Re: etc_pagination: paginate everything
Hi Robhert,
yes, there are few changes (whence my warning), but you are almost there:
<txp:etc_pagination link="<a class='page larger' href='{href}'>{*}</a>,<span class='current'>{*}</span>"
prev="<a class='prevpostslink' href='{href}'>«</a>" next="<a class='nextpostslink' href='{href}'>»</a>"
>
{link}
</txp:etc_pagination>
should be ok. Each “link” attribute (like link
, next
and so on) can come in two states now: general,special
; and the current
attribute plays the role of ex – active
(gone). For example, if you want to show some “next” text even on the last page, you can put
next="<a class='nextpostslink' href='{href}'>»</a>,<span class='nextpostslink'>»</span>"
Sorry for somewhat cowboyish plugin help, I hate wtfm.
Last edited by etc (2013-10-08 21:00:30)
Offline
Re: etc_pagination: paginate everything
Thank you Oleg! Works like a charm!
Offline
Re: etc_pagination: paginate everything
Hi,
I’m trying to use this great plugin on a local site using MLP.
Unfortunatly, the pagination links are http://localhost:8888/en/?pg=3 instead of http://localhost:8888/mywebsite/en/?pg=3.
I’m pretty sure that it’s not a big deal, but I can’t find what to do to make it works…
Thanks for your help!
Last edited by NicolasGraph (2013-11-01 09:11:16)
Offline
Re: etc_pagination: paginate everything
Hi Nicolas,
that’s a strange issue, though I have never used MLP. If you don’t set the root attribute, the plugin generates just ?pg=3
(or &pg=3
) local links (check the page source), so they should be appended by the browser to the page url. What if you manually create some <a href="?pg=3">#</a>
link on the page where you use etc_pagination
, will it be transformed into http://localhost:8888/en/?pg=3
or http://localhost:8888/mywebsite/en/?pg=3
?
Edit: you can try to pass root=’<txp:page_url />’ to etc_pagination
.
Last edited by etc (2013-11-01 11:41:47)
Offline
Re: etc_pagination: paginate everything
Hi Oleg,
Thanks for your help.
the problem is the same with <a href="?pg=3">#</a>
. It means that it doesn’t come from the plugin, isn’t it?
I tried to pass root=’<txp:page_url />’ to etc_pagination
but the result is http://localhost:8888/en/mywebsite/?pg=3
instead of http://localhost:8888/mywebsite/en/?pg=3
.
Last edited by NicolasGraph (2013-11-01 12:15:57)
Offline