Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-11-12 10:55:30

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

mix articles from different sections and categories

could be that i’m missing something obvious but right now, i’m not sure how to achieve the following:

i want to display articles to wich the following applies:

section == A   AND  category == X

AND

section == B  AND  category != J,K,L

had a look at chh_article_custom but that doesn’t do the trick neither… any ideas?

Last edited by sthmtc (2007-11-12 10:59:20)

Offline

#2 2007-11-12 16:44:32

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

Re: mix articles from different sections and categories

This works (but it comes with one or two problems):

On the page: <txp:article_custom form="conditional_form" limit="123" />

Form ‘conditional_form’:

<txp:if_article_section name="A">
<txp:if_article_category name="X">
content
</txp:if_article_category>
</txp:if_article_section>

<txp:if_article_section name="B">
<txp:if_article_category name="J,K,L">
<txp:else />
content
</txp:if_article_category>
</txp:if_article_section>

The problem is that the ‘limit’ attribute doesn’t work properly, because it counts all articles, not just the sections and categories you specify with the conditionals. Therefore I think it also uses a lot of queries to the database and could cause your page to slow down.

Offline

#3 2007-11-12 22:13:10

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: mix articles from different sections and categories

No extra queries, but it would fetch article data that could possibly not be used.

Offline

#4 2007-11-12 22:23:07

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

Re: mix articles from different sections and categories

Thanks Mary. BTW Textbook doesn’t say that if_article_category can also take a comma separated list of categories.

Offline

Board footer

Powered by FluxBB