Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#61 2013-11-22 10:35:24

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

Re: etc_pagination: paginate everything

Hi Ramin,

are these the only <txp:article /> or <txp:image /> tags on the page? Try to put the following code in <txp:else /> part:

<txp:php>global $thispage; echo $thispage['numPages'];</txp:php>

and report the result back.

Offline

#62 2013-11-22 11:31:36

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: etc_pagination: paginate everything

yes thank you dear,
that’s the form of article listing, which have image + title

now i put that code which u told me, just come 1 2
not next previuse, last, first, etc…
what to do ??

Offline

#63 2013-11-22 11:57:26

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

Re: etc_pagination: paginate everything

Ramin, try to put <txp:article pgonly="1" limit="4" /> before <txp:article /> in the else part.

Offline

#64 2013-11-23 12:58:40

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 278

Re: etc_pagination: paginate everything

it’s coming like 1 2 3 , is it possible to put each number to any div or span, cause i want to apply some styles to each number…
and also still no Next, Prev, First, Last navigations ! how i can bring them ?

Last edited by raminrahimi (2013-11-23 13:00:30)

Offline

#65 2013-11-23 13:21:19

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

Re: etc_pagination: paginate everything

Could it be possible that you’ve replaced the <txp:etc_pagination /> tag by etc’s txp:php control code? If so put the plugin tag back on your page.


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

Offline

#66 2013-11-23 13:34:10

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

Re: etc_pagination: paginate everything

To enable next, prev and so on, pass it some next="Next" prev="Previous" first="First" last="Last" attributes. The easiest way to style links is to set some wraptag="nav" html_id="my-nav" attributes, and style <a> and <span> tags therein:

<style>#my-nav > * { your style rules }</style>

<txp:etc_pagination wraptag="nav" html_id="my-nav" next="Next" prev="Previous" first="First" last="Last" />

If you want customize it even more, use it as container:

<txp:etc_pagination wraptag="div"
	link="Page {*}" next="Next" prev="Previous" first="First" last="Last"
>
	<span class="my-nav-class"><a href="{href}">{link}</a></span>
</txp:etc_pagination>

The best way depends on the markup you want to achieve, please provide few details if necessary.

Offline

#67 2014-06-17 21:06:34

worths1
Member
Registered: 2005-03-08
Posts: 18

Re: etc_pagination: paginate everything

Is there a way to either suppress the prev and next links or generate an unanchored li when on the first or last page? For example, is there some to generate the following:

         <ul class="pagination">
           <li><span class="inactive">Newer</span></a></li>
           <li><span data-rel="self">1</span></li>
           <li><a href="?q=the&amp;s=search&amp;pg=2" rel="next">2</a></li>
           <li><a href="?q=the&amp;s=search&amp;pg=3">3</a></li>
           <li><a href="?q=the&amp;s=search&amp;pg=4">4</a></li>
           <li><a href="?q=the&amp;s=search&amp;pg=5">5</a></li>
           <li><a href="?q=the&amp;s=search&amp;pg=2" rel="next">Older</a></li>
         </ul>

BTW, the development version you linked to here seems to be a different plugin now. I’d love it if adding a class to the current li was possible, too. Right now I’m using the plugin as a container and using the {current} attribute to add a class.

        <txp:etc_pagination wraptag="ul" class="pagination" prev="<i class='fa fa-chevron-left'></i>" next="<i class='fa fa-chevron-right'></i>" break="" current=" class='active'" >
           <li{current}><a href="{href}">{link}</a></li>
        </txp:etc_pagination>

generates

        <ul class="pagination">
          <li class='active'><a href="?q=the&amp;s=search&amp;pg=1">1</a></li>  
          <li><a href="?q=the&amp;s=search&amp;pg=2">2</a></li>  
          <li><a href="?q=the&amp;s=search&amp;pg=2"><i class='fa fa-chevron-right'></i></a></li>
        </ul>

Offline

#68 2014-06-19 08:28:38

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

Re: etc_pagination: paginate everything

worths1 wrote #281485:

Is there a way to either suppress the prev and next links or generate an unanchored li when on the first or last page?

Yes, it can be achieved in the container mode, using double link attributes:

<txp:etc_pagination wraptag="ul" break="li" class="pagination"
	link="<a href='{href}'>{*}</a>,<span data-rel='self'>{*}</span>"
	prev="<a href='{href}' rel='prev'>Newer</a>,<span class='inactive'>Newer</span>"
	next="<a href='{href}' rel='next'>Older</a>,<span class='inactive'>Older</span>"
>
	{link}
</txp:etc_pagination>

Actually, prev and next are suppressed by default on the first/last pages.

BTW, the development version you linked to here seems to be a different plugin now.

Ah, forgotten about it, thank you for the report.

I’d love it if adding a class to the current li was possible, too. Right now I’m using the plugin as a container and using the {current} attribute to add a class.

You mean, to the current break tag? OK, will add it in the next version.

Offline

#69 2014-06-19 17:17:21

worths1
Member
Registered: 2005-03-08
Posts: 18

Re: etc_pagination: paginate everything

Thank you!

EDIT

 <txp:etc_pagination wraptag="ul" class="pagination"
    link="<li><a href='{href}'>{*}</a></li>,<li class='active'><span data-rel='self'>{*}</span></li>"
    prev="<li><a href='{href}' rel='prev'><i class='fa fa-chevron-left'></i></a></li>,<li class='inactive'><span><i class='fa fa-chevron-left'></i></span></li>"
    next="<li><a href='{href}' rel='next'><i class='fa fa-chevron-right'></i></a></li>,<li class='inactive'><span><i class='fa fa-chevron-right'></i></span></li>"
>
   {link}
 </txp:etc_pagination>

Works exactly as I want. No changes needed for me. I just misunderstood the link, prev and next attributes.

Last edited by worths1 (2014-06-19 18:12:10)

Offline

#70 2014-10-29 04:39:35

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

Re: etc_pagination: paginate everything

Hi! I just have installed Textpattern (4.5.7) and I have this “bug”: the Next text link or numbers ahead give the right link, but the previous numbers or Prev text, gives nothing.

This is my code:

<txp:etc_pagination wraptag="div" class="pagination" current="class='btn'"
			link="<a class='btn light' href='{href}'>{*}</a>,<span>{*}</span>"
			prev="<a class='btn light' href='{href}' rel='prev'>Prev</a>" 
			next="<a class='btn light' href='{href}' rel='next'>Next</a>"><span {current}>{link}</span>
			</txp:etc_pagination>

And this is what I get (in Prev text or number 1, there is no “href” value:

<div class="pagination"><span ><a class='btn light' href=''>Prev</a></span>
			<span ><a class='btn light' href=''>1</a></span>
			<span class='btn'><span>2</span></span>
			<span ><a class='btn light' href='?pg=3'>3</a></span>
			<span ><a class='btn light' href='?pg=3'>Next</a></span>
			</div>

Any ideas?

Offline

#71 2014-10-29 20:44:19

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

Re: etc_pagination: paginate everything

Hi Robhert,

actually, index.php and index.php?pg=1 land on the same page, so etc_pagination omits pg=1 in the links, to avoid storing two page copies in cache. Clicking “Prev” (with empty href) should simply bring you to the default (first) page, is there any problem with this? That’s like <txp:newer/older /> work too. If you need more qualified urls, try to set root="" parameter in etc_pagination.

Offline

#72 2014-10-29 21:54:31

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

Re: etc_pagination: paginate everything

Hi etc

Right now I’m on the page number 3 of my website and this is what I get:

<div class="pagination"><span ><a class='btn light' href='?pg=2' rel='prev'>Prev</a></span>
 <span ><a class='btn light' href=''>1</a></span>
 <span ><a class='btn light' href='?pg=2'>2</a></span>
 <span class='btn'><span>3</span></span>
 <span ><a class='btn light' href='?pg=4'>4</a></span>
 <span ><a class='btn light' href='?pg=4' rel='next'>Next</a></span>
</div>

But in my status bar, I see:

Prev: ?pg=2
1: ?pg=3
2: ?pg=2
3
4: ?pg=4
Next: ?pg=4

As you may see, the link to page 1, is the same where I am (page number 3).

EDIT 1: As far I can see, the problem is with the first link, or the first page. Once I´m on the page 2, or 3, or 4, I can´t back to first page. All I see is an empty href which takes me no where (the same page, where I am).

Last edited by robhert (2014-10-29 22:25:45)

Offline

Board footer

Powered by FluxBB