You are not logged in.
Pages: 1
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
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
(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
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
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.
<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields
Offline
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
It should be case-sensitive regardless, so just consider all tags that way, even if at times you seem to not have to.
My email address has changed recently. If you need to contact me, use the forum contact form.
Offline
Pages: 1