Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Article list pagination on list page and article page
Have looked around but haven’t been able to find a solution to my problem. Hope the community can help.
What I’m trying to achieve is display of a section’s article title list as a sub navigation which paginates after 8 article titles. I’d like it to behave in the same way both when landing in the section page and when viewing individual articles within the section. What I can’t figure out is how to make the article list paginate.
The code I’m using is:
<div id="sub-navigation">
<txp:if_individual_article>
<txp:article_custom section='<txp:section />' sort="Posted desc" limit="8">
<txp:if_first_article><ul class="whatever"></txp:if_first_article>
<li<txp:if_article_id> class="active"</txp:if_article_id>><txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article></ul></txp:if_last_article>
</txp:article_custom>
<txp:else />
<txp:article_custom section='<txp:section />' sort="Posted desc" limit="8">
<txp:if_first_article><ul class="whatever"></txp:if_first_article>
<li<txp:if_first_article> class="active"</txp:if_first_article>><txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article></ul></txp:if_last_article>
</txp:article_custom>
</txp:if_individual_article>
</div>
I have tried inserting <p><txp:older>Previous</txp:older> <txp:newer>Next</txp:newer></p>
inside and outside the conditional statement but it only produced an empty <p> </p>
Last edited by catnip (2010-02-06 23:50:21)
Offline
Re: Article list pagination on list page and article page
use the rss_suparchive plugin that will let you to have paging for custom articles lists
(I uploaded the file to my Fileden account because Rob Sable’s website got a problem)
Then use it like this:
<txp:rss_suparchive section="your-section" form="your-list-form" limit="8" />
and add the older
& newer
tags below/above as you want.
you can also use the soo_page_numbers plugin do have the pages numbers links.
maybe there is a better way of doing it, and if so I will like to know it too ;)
Offline
Re: Article list pagination on list page and article page
Thanks Gil. Works like a charm. What I’m losing out on though is the ability to target the active article when landing in the section? My previous code snippet (above) made sure the title of the first article in the sub-navigation had a class=“active”. Any ideas?
My list form is:
<li class="<txp:rvm_if_this_article>active<txp:else />inactive</txp:rvm_if_this_article>">
<a href="<txp:permlink />"><txp:title /></a>
</li>
Offline
Re: Article list pagination on list page and article page
sorry never tried it, but if it’s works with regular article_custom tag so I guess it’s supposed to work with rss_suparchive too.
Offline