Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-10-14 15:21:57

Wolfgang
Member
From: Germany
Registered: 2006-07-18
Posts: 71
Website

How do I realize a case-structure in a page-template?

Hello

Its the following structure:

<txp:if_category name="cat_1">
  ... do something for cat_1
<txp:else />
  ... do something if no cat.
</txp:if_category>

Here I want to add a second cat but I do not want to write:

<txp:if_category name="cat_1">
  ... do something for cat_1
<txp:else />
  <txp:if_category name="cat_2">
    ... do something for cat_2
  <txp:else />
    ... do something if no cat.
  </txp:if_category>
</txp:if_category>

Is that possible?

Thanks for help
wolfgang

Last edited by Wolfgang (2007-10-14 15:24:43)

Offline

#2 2007-10-14 15:47:38

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

Re: How do I realize a case-structure in a page-template?

You cannot nest identical conditional tags. So it would have to be something like this:

<txp:if_category name="cat_1">
  ... do something for cat_1
</txp:if_category>

<txp:if_category name="cat_2">
    ... do something for cat_2
</txp:if_category>

<txp:if_category>
<txp:else />
    ... do something if no cat.
</txp:if_category>

Offline

#3 2007-10-14 17:03:35

Wolfgang
Member
From: Germany
Registered: 2006-07-18
Posts: 71
Website

Re: How do I realize a case-structure in a page-template?

thanks – I’ve searched for an <txp:case …> Statement or something. But it works …

Offline

Board footer

Powered by FluxBB