Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-05 20:52:51

zeeforel
Member
From: Nieuwerkerk a/d IJssel, NL
Registered: 2004-10-16
Posts: 92
Website

Nesting tags for checking individual article and category: pls. help!

Hi to you all,

I am trying the achieve the following: on a sidebar on a page (so not in form) I want to execute some script but only:
+ if TXP calls an individual article and the category of the article is “catname”
+ if TXP calls an category page and the category of the articles is “catname”

Please find below the code I am using, but only the second action works, when calling individual articles the script does not run. What am I doing wrong?

Many thanks in advance.

Marcel

+++++++++++++++++++++++++++++

<txp:if_individual_article>

<txp:if_category name=“catname”> <some script></script> <txp:else /> </txp:if_category>

<txp:else />

<txp:if_category name=“catname”> <some script></script> <txp:else /> </txp:if_category>

</txp:if_individual_article>

Offline

#2 2006-11-05 21:13:58

zeeforel
Member
From: Nieuwerkerk a/d IJssel, NL
Registered: 2004-10-16
Posts: 92
Website

Re: Nesting tags for checking individual article and category: pls. help!

Hi Ruud,

I do not understand how your example is going to do both things I want at the same time?

I wonder whether the issue here is that I can not get TxP to use the <txp:if_category name=“catname”> in the if_individual_article tag. Is that category query going to work on a page in stead of a form?

Marcel

Last edited by zeeforel (2006-11-05 21:31:55)

Offline

#3 2006-11-05 21:22:19

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Nesting tags for checking individual article and category: pls. help!

(earlier example deleted.. what was I thinking).

Try if_article_category instead of if_category when you’re checking an individual article:

<txp:if_individual_article>
<txp:if_article_category name=“catname”> <some script></script> <txp:else /> </txp:if_article_category>

<txp:else />
<txp:if_category name=“catname”> <some script></script> <txp:else /> </txp:if_category>

</txp:if_individual_article>

Last edited by ruud (2006-11-05 21:24:39)

Offline

#4 2006-11-05 21:30:19

zeeforel
Member
From: Nieuwerkerk a/d IJssel, NL
Registered: 2004-10-16
Posts: 92
Website

Re: Nesting tags for checking individual article and category: pls. help!

Hi Ruud,

That does not help. I still think it’s got something to do with what I said above…

Anyone?

IS IT SO STRANGE TO CHANGE A PAGE LAYOUT FOR INDIVIDUAL ARTICLE PUBLISHING BASED ON A SPECIFIC CATEGORY?

Last edited by zeeforel (2006-11-05 22:27:40)

Offline

#5 2006-11-05 22:48:09

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

Re: Nesting tags for checking individual article and category: pls. help!

Try this:

<txp:if_individual_article>
<txp:if_article_category name="catname">
<some script></script>
</txp:if_article_category>
</txp:if_individual_article>

<txp:if_category name="catname">
<some script></script>
</txp:if_category>

(You can leave out the <txp:else /> if nothing comes after it.)
But: <txp:if_article_category> can only be used on a page in 4.0.4, not in earlier versions.

Offline

#6 2006-11-06 06:53:53

zeeforel
Member
From: Nieuwerkerk a/d IJssel, NL
Registered: 2004-10-16
Posts: 92
Website

Re: Nesting tags for checking individual article and category: pls. help!

Hi Els,

Unfortunately, I still can not get the first script to work. The if_individual_article part works, but the subsequent script after the if_article_category tag is neve run (and this time I am working with category name and not title!).

I am working on 4.0.4 now by the way.

Any idea’s?

Edit: it works now but only because I found out that, in if_article_category the catname is case sensative in contrast to in if_category! Strange, but at least it works now!

Last edited by zeeforel (2006-11-06 06:55:41)

Offline

#7 2006-11-06 16:50:01

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

Re: Nesting tags for checking individual article and category: pls. help!

It should be case-sensitive regardless, so just consider all tags that way, even if at times you seem to not have to.

Offline

Board footer

Powered by FluxBB