Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#73 2014-10-30 09:24:40

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

Re: etc_pagination: paginate everything

Shame on me, I guess I have not tested it in all browsers/situations in the latest version. Please download and try again, sorry.

Offline

#74 2014-10-30 16:08:49

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

Re: etc_pagination: paginate everything

Hi etc! It works like a charm now!

Thank you very much!

Last edited by robhert (2014-10-30 16:09:08)

Offline

#75 2014-10-30 17:23:50

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

Re: etc_pagination: paginate everything

Thank you for the report, Robhert, and sorry again for the trouble.

Offline

#76 2014-10-30 22:55:22

MrLongbaugh
Member
From: Hamburg - Germany
Registered: 2004-10-11
Posts: 116

Re: etc_pagination: paginate everything

Hey there,

for a section news I would like to show a list of news in a colum. As there a quite some news they should be shown up as 10 per page with a link forth and back.

I used the plugin etc_pagination

For this the article_custom tag is used

<txp:article_custom form="article_listing" offset="0" pgonly="1" status="4" section="News" limit="5" offset='<txp:etc_offset pgcounter="page" pageby="5" />' />

If it is in article mode everything works great. But if an article link is clicked an it is in individual_article mode the pagination is no longer shown.

Is there another way to show the article list in either mode?

Thanks for any idea.

Last edited by MrLongbaugh (2014-11-04 19:54:31)

Offline

#77 2014-10-31 20:17:18

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

Re: etc_pagination: paginate everything

Hello,

to function properly, etc_pagination needs two parameters:

  • the number of pages. This is set by <txp:article /> (not custom), but not for individual article views;
  • the current page. This is typically given by pg URL parameter, but you seem to use page (which is ok). Again, individual articles URL do not contain it.

You can, however, create them manually. Try putting this in your column

<txp:if_individual_article>
<txp:etc_pagination pgcounter="page" pages='<txp:etc_numpages section="news" />' />
<txp:else />
... the prev/next stuff that currently works ...
</txp:if_individual_article>

This should produce a pagination bar in the individual article mode too, but we still have no information on the current page number. To add it, you could append something like ?page=<txp:etc_offset pgcounter="page" type="page" /> to the articles url in article_listing form.

Don’t hesitate if you need further assistance.

Offline

#78 2014-11-04 19:48:01

MrLongbaugh
Member
From: Hamburg - Germany
Registered: 2004-10-11
Posts: 116

Re: etc_pagination: paginate everything

Thanks etc,

thanks a lot. That worked perfectly.

Just for the record:

<txp:if_individual_article>
  <txp:article_custom form="article_listing" offset="0" pgonly="1"  status="4" 
    section="news" limit="10"  offset='<txp:etc_offset pgcounter="page" pageby="10" />' />
<txp:else />
  <txp:article_custom form="article_listing" offset="0" pgonly="1"  status="4" 
    section="news" limit="10"  offset='<txp:etc_offset pgcounter="page" pageby="10" />' />
</txp:if_individual_article>
<div id="pagi">
  <txp:etc_pagination pages='<txp:variable name="numPages" />' pgcounter="page"
	 prev="&#171; vor" next="weiter &#187;" break=" | " /></div>
</div>

And the link in the form:

<a href="<txp:permlink />?page=<txp:etc_offset pgcounter="page" type="page" />">
  <txp:title />
</a>

Last edited by MrLongbaugh (2014-11-04 19:50:22)

Offline

#79 2015-03-20 11:47:51

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: etc_pagination: paginate everything

Hi Oleg,

Great plugin!

Is there a way I can get close to the following markup?

<nav class="layout--span-1-8 paginator" aria-label="Blog navigation">
    <a class="prev" rel="prev" href="#" title="Go to previous page" aria-label="Go to previous page">Prev</a>
    <a class="next" rel="next" href="#" title="Go to next page" aria-label="Go to next page">Next</a>
    <ul class="pagination">
        <li>
            <a rel="prev" href="#" title="Go to page 1" aria-label="Go to page 1">1</a>
        </li>
        <li>
            <span data-rel="self">2</span>
        </li>
        <li>
            <a rel="next" href="#" title="Go to page 3" aria-label="Go to page 3">3</a>
        </li>
        <li>
            <a href="#" title="Go to page 4" aria-label="Go to page 4">4</a>
        </li>
        <li>
            <a href="#" title="Go to page 5" aria-label="Go to page 5">5</a>
        </li>
        <li>
            <a href="#" title="Go to page 6" aria-label="Go to page 6">6</a>
        </li>
        <li>
            <a href="#" title="Go to page 7" aria-label="Go to page 7">7</a>
        </li>
        <li>
            <a href="#" title="Go to page 8" aria-label="Go to page 8">8</a>
        </li>
        <li>
            <a href="#" title="Go to page 9" aria-label="Go to page 9">9</a>
        </li>
        <li>
            <a href="#" title="More pages" aria-label="More pages">&hellip;</a>
        </li>
    </ul>
</nav>

The <nav> tag I can generate myself outs of the tag, so that and it’s attributes don’t need to be considered.

By the way, rel=first and rel=last are not valid in HTML5, so I would want those to appear in any code.

Also, it’d be great if this plugin was available on GitHub – I could certainly help with some of the documentation if it were.

Offline

#80 2015-03-20 12:26:25

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

Re: etc_pagination: paginate everything

Hi Phil, thank you. This should be close to what you want:

<txp:etc_pagination wraptag="ul" class="layout--span-1-8 paginator" atts=' aria-label="Blog navigation"'
	prev='<a class="prev" rel="prev" href="{href}" title="Go to previous page" aria-label="Go to previous page">Prev</a>'
	next='<a class="next" rel="next" href="{href}" title="Go to next page" aria-label="Go to next page">Next</a>'
	link='<li><a href="{href}" title="Go to page {*}" aria-label="Go to page {*}">{*}</a></li>,<li><span data-rel="self">{*}</span></li>'
	mask='{prev}{next}
	<ul class="pagination">
		{links}
		<li><a href="#" title="More pages" aria-label="More pages">&hellip;</a></li>
	</ul>' 
/>

You can add rel="{rel}" attribute to <a /> in link, but they will produce these invalid (sorry and thanks) last/first as well as empty values. Tell me if you need it, it’s been a long time I haven’t touched etc_pagination. And thank you for the help proposal — gladly accepted — it remains me to read GitHub howtos. :)

Last edited by etc (2015-03-20 12:28:34)

Offline

#81 2015-03-20 14:25:30

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: etc_pagination: paginate everything

Hi Oleg,

I’m so close, yet still got a couple of issues! I’m actually using this code so far:

<txp:variable name="more" value='<txp:newer /><txp:older />' />
<txp:variable name="prev" value='<txp:newer />' />
<txp:variable name="next" value='<txp:older />' />
<txp:if_variable name="more" value="">
<txp:else />
    <div class="wrapper-inner <txp:variable name="wrapper-inner" />">
        <div class="container">
            <nav class="layout--span-1-8 paginator" aria-label="Blog navigation">
                <txp:if_variable name="prev" value="">
                    <span class="prev disabled" aria-label="This is the first page">Prev</span>
                <txp:else />
                    <a class="prev" rel="prev" href="<txp:newer />" title="Go to previous page" aria-label="Go to previous page">Prev</a>
                </txp:if_variable>
                <txp:if_variable name="next" value="">
                    <span class="next disabled" aria-label="This is the last page">Next</span>
                <txp:else />
                    <a class="next" rel="next" href="<txp:older />" title="Go to next page" aria-label="Go to next page">Next</a>
                </txp:if_variable>
                <txp:etc_pagination wraptag="ul" class="pagination" range="4"
                    link='<li><a href="{href}" title="Go to page {*}" aria-label="Go to page {*}">{*}</a></li>,<li class="current"><b title="Current page" aria-label="Current page">{*}</b></li>'
                    gap='<li><span title="More pages" aria-label="More pages">…</span></li>'
                    mask="{links}"/>
            </nav>
        </div>
    </div>
</txp:if_variable>

But the gap symbol (…) is not being rendered at all, or the last page number and/or first page number.

So I’ve got this so far:

<nav class="layout--span-1-8 paginator" aria-label="Blog navigation">
    <a class="prev" rel="prev" href="#" title="Go to previous page" aria-label="Go to previous page">Prev</a>
    <a class="next" rel="next" href="#" title="Go to next page" aria-label="Go to next page">Next</a>
    <ul class="pagination">
        <li><a href="#" title="Go to page 3" aria-label="Go to page 3">3</a></li>
        <li><a href="#" title="Go to page 4" aria-label="Go to page 4">4</a></li>
        <li class="current"><b title="Current page" aria-label="Current page">5</b></li>
        <li><a href="#" title="Go to page 6" aria-label="Go to page 6">6</a></li>
        <li><a href="#" title="Go to page 7" aria-label="Go to page 7">7</a></li>
    </ul>
</nav>

When I need to get to this:

<nav class="layout--span-1-8 paginator" aria-label="Blog navigation">
    <a class="prev" rel="prev" href="#" title="Go to previous page" aria-label="Go to previous page">Prev</a>
    <a class="next" rel="next" href="#" title="Go to next page" aria-label="Go to next page">Next</a>
    <ul class="pagination">
        <li><a href="#" title="Go to page 1" aria-label="Go to page 1">1</a></li>
        <li><span title="More pages" aria-label="More pages">&hellip;</span></li>
        <li><a href="#" title="Go to page 3" aria-label="Go to page 4">4</a></li>
        <li class="current"><b title="Current page" aria-label="Current page">5</b></li>
        <li><a href="#" title="Go to page 5" aria-label="Go to page 6">6</a></li>
        <li><span title="More pages" aria-label="More pages">&hellip;</span></li>
        <li><a href="#" title="Go to page 11" aria-label="Go to page 11">11</a></li>
    </ul>
</nav>

Offline

#82 2015-03-20 18:15:50

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

Re: etc_pagination: paginate everything

Almost there, I think, just replace mask value with {first}{<+}{links}{+>}{last}.

Offline

#83 2015-03-20 20:47:08

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: etc_pagination: paginate everything

That’s absolute perfect Oleg, exactly what I needed! Thanks again for the great plugin.

If/when you get to grips with github, I’ll happy to help write out some deeper documentation for this plugin.

Offline

#84 2015-03-20 22:40:26

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

Re: etc_pagination: paginate everything

Thank you for the feedback, Phil, nice to hear it. I have created a github repository and added you as contributor (don’t know if it works), please feel free to contribute in any way.

I have removed the depreciated rel values from the next version, but note that you can alter the output of any plugin with etc_query:

<txp:etc_query data='<txp:etc_pagination ... />'
	replace="//a[@rel='' or @rel='first' or @rel='last']@@rel" />

will remove the offending rel attribute from <a />s.

Offline

Board footer

Powered by FluxBB