Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2006-02-07 11:42:09

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

@ thebombsite:

is it possible to limit number of the results when you use your trick? right now it will show all articles from that category. Would if_article_list conditional do the trick on the archive page?

Offline

#14 2006-02-07 11:53:08

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: articles only from certain category

I use <code><txp:if_category></txp:if_category></code> tags which allows me to pop a title in for the category and use a different <code><txp:article /></code> tag for the listing. This would allow you to use a different form template, maybe only show excerpts, and have a different “limit” but that would only affect paging. As far as I know you can’t place a limit on the total number of articles that are output.

Mind you, I could be wrong there. Wouldn’t be the first time. ;)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#15 2006-02-07 14:58:46

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

Yes, I need it only for paginating articles within a certain category, but I have like 30 cats, how can I do that? I would want the same properties for all of them, Same nuber of articles per page, same templates, same everything. I can’t seem to get that.

Offline

#16 2006-02-08 00:20:18

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

OK I have got to a point with if_category where i display as much articles as I would like, but how do I add pagination? txp:newer and txp:older don’t work. :( (it says they are an undefined variable)

Last edited by Dragan (2006-02-08 00:22:13)

Offline

#17 2006-02-08 01:47:15

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: articles only from certain category

You would need something like:-

<code>
<txp:if_category>
<txp:article limit=“30” form=“formName” />
<txp:else />
<txp:article limit=“5” />
</txp:if_category>
<txp:older>previous</txp:older> <txp:newer>next</txp:newer></code>


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#18 2006-02-08 08:40:57

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

thebombsite that works like a charm, but, I can’t say I understand what it acctually does, here is what I put in in the archive page:
<code> <txp:if_category> <txp:article limit=“5” /> <txp:else /> <txp:article limit=“5” /> </txp:if_category>

<ul class=“pagin”> <li><txp:newer>&laquo; Noviji</txp:newer></li> <li class=“older”><txp:older>Stariji &raquo;</txp:older></li>
</ul>
</code>

Offline

#19 2006-02-08 10:37:05

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: articles only from certain category

Well it simply asks if we are in a category list output 30 articles using the “formName” form template, else if we aren’t, output 5 articles (using the default form which doesn’t need specifying), then output the paging links what ever we are in.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#20 2006-02-09 15:01:09

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

> doggiez wrote:

> bq. I’m also interested in getting rid of empty elements, for instance while paginating, when there is no “next” or “previous”.
Also, I don’t like having empty elements lying around serveing no purpouse.

Would chh_if_data help you with this?

I have been messing with this plugin and it doesn’t seem to do what I want. It still outputs an empty a element, my code goes something like this:
<code>
<txp:cch_if_data>
<a href=”<txp:site_url /><txp:section />/?c=<txp:category2 />”><txp:category2 title=“1” /></a>
</txp:cch_if_data>
</code>

Am I not using it correctly? I didn’t use the :else because I don’t want anything output.

Offline

#21 2006-02-09 15:36:21

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: articles only from certain category

Ah, I was wondering why you didn’t use <txp:category2 title=1 link=1 />, but I see you need the section in the url.

I think the plugin doesn’t work because there is more than one txp tag inside, and only one of them doesn’t have content.

Try this:
<code>
<txp:if_article_category number=“2” name=”“>
<a href=”<txp:site_url /><txp:section />/?c=<txp:category2 />”><txp:category2 title=“1” /></a>
</txp:if_article_category>
</code>

Offline

#22 2006-02-09 19:32:17

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

Oh my god I can’t believe that worked! :)
BTW, what’s the name=”“ for? I ditched it.

Offline

#23 2006-02-09 19:41:46

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: articles only from certain category

Ah, so it works without that as well? I am using that with <txp:if_category> to say ‘if we are on a (any) category page…’ so I guessed it would work with <txp:if_article_category>. But nice to know you don’t even need it :)

Offline

#24 2006-02-09 19:49:20

Dragan
Member
From: Novi Sad, Serbia
Registered: 2005-10-26
Posts: 100
Website

Re: articles only from certain category

coudn’t be better :)

Offline

Board footer

Powered by FluxBB