Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-06 19:40:21

Ji31
Member
Registered: 2005-08-24
Posts: 103

Category condition

Why is this not working:

txp:if_article_category name=“news” number=“1”
h2News added to the gallery:/h2
txp:article form=“single_news” limit=“1” listform=“single_news” /
/txp:if_article_category

I see just blank place…

Thanx

Offline

#2 2006-04-06 19:46:33

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: Category condition

Your code is difficult to understand as formatted. Please see the FAQ: How do I post tags and code on the forum?.

What are you trying to accomplish with this code? It looks as though you’re trying to show one article from the “news” category, in which case I might recommend the <txp:article_custom /> tag.

Also note that <txp:if_article_category>...</txp:if_article_category> can only be called from within an article form.

-Kurt


kurt@kurtraschke.com

Offline

#3 2006-04-06 19:54:51

Ji31
Member
Registered: 2005-08-24
Posts: 103

Re: Category condition

I want to show one article form if the category is “news” and other article form if the categories are different to “news”.

<txp:if_article_category name=”news” number=”1”>
<txp:article form=”single_news” limit=”1” listform=”single_news” />
<txp:else />
<txp:article form=”single” limit=”1” listform=”single” />
</txp:if_article_category>

And thanx for the showing how to post tags in the forum...

Offline

#4 2006-04-06 19:57:29

KurtRaschke
Plugin Author
Registered: 2004-05-16
Posts: 275

Re: Category condition

Instead of using a conditional in your page and then having two article forms, use one <txp:article /> tag and one article form, then the category conditionals within your article form. Like so:

<txp:if_article_category name=”news” number=”1”>
form content for 'news' category
<txp:else />
form content for all other categories
</txp:if_article_category>

-Kurt


kurt@kurtraschke.com

Offline

#5 2006-04-06 21:04:58

Ji31
Member
Registered: 2005-08-24
Posts: 103

Re: Category condition

It’s smart – and working! Thank you!

Offline

Board footer

Powered by FluxBB