Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-05-29 20:23:51

mattgilbert
Member
Registered: 2006-03-23
Posts: 70

nested if_category tags?

i seem to be having trouble nesting if_category tags, and I was wondering if there was something wrong with trying this. I want to first test whether or not the page is a category page (as in Example 2 from the textbook entry ). If it is a category page, I want to display different content for different categories. I get the error:

<code>tag_error <txp:else/> -> Textpattern Warning: unknown_tag</code>

which is ridiculous, obviously. i’ve been very careful about making sure the else tags follow the if_category tags and that the if_category tags are closed after the else tags, etc. Are nested if_category tags possible? Anyone else have this problem?

Offline

#2 2006-05-29 21:01:11

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: nested if_category tags?

Make sure you’ve got a space (” “) between the “e” and the slash. <txp:else />. That’s messed me up dozens of times.

Offline

#3 2006-05-29 21:18:10

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

Re: nested if_category tags?

Offline

#4 2006-05-29 21:27:15

mattgilbert
Member
Registered: 2006-03-23
Posts: 70

Re: nested if_category tags?

thanks, deldindesign!

that wasn’t exactly my problem, but apparently a similar problem occurs with the closing if_category tags, which sometimes causes the unknown tag error for else tags, and sometimes makes an if_category tag with no attributes fail to behave as it does in example 2 from textbook. Whether or not there’s a space between the “y” and the “>” in the closing tag seems to matter (way too much), but i can’t tell what the rule is. Sometimes you need one, sometimes you need to not have one.

Last edited by mattgilbert (2006-05-29 21:28:14)

Offline

#5 2006-05-29 21:31:18

mattgilbert
Member
Registered: 2006-03-23
Posts: 70

Re: nested if_category tags?

Mary:

perhaps this doesn’t apply if one if_category tag has no attributes and the nested one does? perhaps this makes them different in such a way that the limitation pointed out in that FAQ doesn’t apply? i’m suggesting this because this is what seems to be happening for me.

Offline

#6 2006-05-30 03:26:18

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

Re: nested if_category tags?

The parameters shouldn’t make a difference to this current limitation of the tag parser I was talking about: an if_category tag put inside another if_category tag. But, you seem to be talking about if_category nested inside some other tag, where the problem doesn’t apply.

Offline

#7 2006-06-11 23:47:42

Frdrrrddy
New Member
Registered: 2006-03-12
Posts: 5

Re: nested if_category tags?

Hi,

I seem to have a similar kind of problem. (Or maybe I just don’t understand Textpattern well enough. ;) )

I’ve got 4 categories. On my frontpage I want to display the excerpts (‘Samenvatting’) of the latest article in each category.

On a category-page I want to display the excerpts of the 4 latest articles in this particular category.

I just can’t seem to get it done.

Can anyone tell me what’s wrong with this piece of code? (And perhaps where I could have found the answer if I had looked even better…?)

<code>
<txp:if_category>
<txp:article_custom form=“Samenvatting” limit=“4” sortby=“Posted” sortdir=“desc” listform=“Samenvatting” />
<txp:else />
<txp:article_custom form=“Samenvatting” limit=“1” category=“website” sortby=“Posted” sortdir=“desc” listform=“Samenvatting” />
<txp:article_custom form=“Samenvatting” limit=“1” category=“column” sortby=“Posted” sortdir=“desc” listform=“Samenvatting” />
<txp:article_custom form=“Samenvatting” limit=“1” category=“reclame” sortby=“Posted” sortdir=“desc” listform=“Samenvatting” />
<txp:article_custom form=“Samenvatting” limit=“1” category=“journalistiek” sortby=“Posted” sortdir=“desc” listform=“Samenvatting” />
</txp:if_category>
</code>

Offline

#8 2006-06-12 00:59:26

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

Re: nested if_category tags?

On a category-page I want to display the excerpts of the 4 latest articles in this particular category.

article_custom isn’t context-sensitive, which means it can’t tell which category you want to display from the url, like article can. Are you needing to use article_custom for another reason?

Offline

#9 2006-06-12 09:14:39

Frdrrrddy
New Member
Registered: 2006-03-12
Posts: 5

Re: nested if_category tags?

Thanks. That was very helpful. I needed article_custom for my frontpage, so I assumed I needed it for the category-page as well. (I’m still learning. So thx again.)

Offline

Board footer

Powered by FluxBB