Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pagination while listing articles by category - full topic
I’m starked – I’ve tried thousands of ways, searched through all forum and don’t know know yet how to
enable pagination while listing articles by category?
I used such way:
Page template:
<txp:if_category>
<txp:chh_article_custom limit="3" form="lofi" category="?" listform="ghost_list_category" />
</txp:if_category>
lofi form:
<txp:if_category>
<txp:chh_article_custom limit="3" form="lofi" category="?" listform="ghost_list_category" />
</txp:if_category>
ghost_list_category form:
<h1><txp:permlink><txp:title /></txp:permlink></h1>
<br />
<txp:excerpt />
<br />
And some lines bellow I wrote:
<txp:if_article_list>
<txp:newer>Back</txp:newer>
<br />
<txp:older>Forward</txp:older>
</txp:if_article_list>
As result – articles are limitting by 3, but there is no ane pagination links! For main page i used such code:
<txp:glx_if_frontpage>
<txp:article sort="Posted desc" limit="3" />
</txp:glx_if_frontpage>
And this one works – Forward\back links appear!
How to list articles by current catagory with pagination links?
The tag_trace is here.
The site is avaible (it’s in russian :) here is link to category and here is homу url. Currently site mode is set to “debug”.
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#2 2007-09-23 12:07:16
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Pagination while listing articles by category - full topic
On the page:
<txp:if_category>
<txp:article limit="3" listform="ghost_list_category" />
</txp:if_category>
Forget the ‘lofi’ form.
<txp:article />
is context sensitive, so when on a category page, it will automatically display an article list from that particular category.
You can even do this (without the conditional):
<txp:article limit="3" form="single_article_form" listform="ghost_list_category" />
When on a single article page it will use form “single_article_form” and when on an article list page it will use “ghost_list_category”.
Offline
Re: Pagination while listing articles by category - full topic
Els wrote:
On the page:
…
Thanks, but it doesn’t help. It don’t want to show articles when openning any category… I’m confused… Because article_custom works fine. May be there is way to enable pagination for article_custom?
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
#4 2007-09-23 21:15:37
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Pagination while listing articles by category - full topic
Pagination doesn’t work with article_custom, that’s why I suggested <txp:article />
.
Is the page you are using this code on the default page template or a separate section page? Because if you want to display articles from a particular section on another section’s page, then you’re right, my code won’t work. But I thought that with chh_article_custom (or else maybe chh_article) pagination was possible?
Offline
Re: Pagination while listing articles by category - full topic
Els wrote:
Pagination doesn’t work with article_custom, that’s why I suggested
<txp:article />
.
I understand the difference between article
and article_custom
. I just want to say – article_custom shows desirable articles, but woithout pagination. It can only limit the amount of displayed articles.
Els wrote:
Is the page you are using this code on the default page template or a separate section page? Because if you want to display articles from a particular section on another section’s page, then you’re right, my code won’t work. But I thought that with chh_article_custom (or else maybe chh_article) pagination was possible?
I have one page template for all sections.
Els wrote:
But I thought that with chh_article_custom (or else maybe chh_article) pagination was possible?
I thought so too and was disappointed whe found that it can not :(
May be any hack is avaible?
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Pagination while listing articles by category - full topic
the_ghost wrote:
May be any hack is avaible?
Sure! :) On line 664 (as of txp 4.5) replace
$theAtts['frontpage'] = ($s && $s=='default')? true: false;
by
$theAtts['frontpage'] = ($s && $s=='default' && !$theAtts['frontpage'])? true: false;
Then add the attribute frontpage='<txp:if_category>1</txp:if_category>'
to your <txp:article />
tag. The pagination should work now for article-by-category lists, and I don’t know what is broken, probably sections’ on_frontpage
setting.
Offline