Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-01-08 14:45:30

bottlerocket
Member
Registered: 2009-12-07
Posts: 11

Pagination issues using older/newer & Prev/Next

I have a relatively simple situation but am being frequently bedevilled by it all.

I am building a simple blog and I am using the newer/older tags and prev/next tags to provide simple pagination across the site. newer/older for navigation pages through article lists, which displays 5 articles per ‘page’. Prev/Next is used to page through each article individually.

The problem is I want to style the links more than the generic text link i have for links across the site. I am acutally using a grpahic background etc. So to implement this for the old newer and older txp tags, i use the link in an a tage: <a href=”<txp: newer/>” class=“myLinkClass”> link name</a>

Anyway, doing it this way means that there is no logic of when the links appear. For instance, at the first page of a list of articles, showing say 5 of 20 articles, the ‘newer’ link shouldnt appear, only the older. However, putting the older/newer link in the a tag means the a tag always appears regardless if there are newer or older articles.

The same logic applies to pre/next.

Ideally, having a wrap tag might be a way around it. However, my PHP is non-existant, so some other forum posts on this, I havent been able to benefit from.

I have tried using some conditional tags, e.g. <txp:if_first_article> and <txp:if_last_article>
but not only is the condition not working, probably my dodgy implementation no doubt, it doesn’t apply to when a user is viewing a full article and wants to move to the next or previous article.

Any help/pointers, will be greatly appreciated.

Kind regards

Offline

#2 2010-01-08 14:55:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,942
Website GitHub

Re: Pagination issues using older/newer & Prev/Next

bottlerocket wrote:

i use the link in an a tage: <a href=”<txp: newer/>” class=“myLinkClass”> link name</a>

Can you wrap your anchor in txp:newer so the whole thing only appears if there is a newer page (see example 3)? e.g.

<txp:newer>
   <a href="<txp:newer />" class="linkClass"> link name</a>
</txp:newer>

Not sure if it works for link_to_next and link_to_prev, but it should.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2010-01-08 15:17:32

bottlerocket
Member
Registered: 2009-12-07
Posts: 11

Re: Pagination issues using older/newer & Prev/Next

Well, thankyou.

Sometimes my stupidity even astounds me. That’s a really simple solution that honestly, I should have worked out myself.

So thanks very much for that.

Offline

Board footer

Powered by FluxBB