Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-08 20:29:19

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

If_section Else not working as expected

Any idea why the Else isn’t being reached, the url is www.mysite.com? The first comma in the if_section should catch the fact that this is the default section and as there is no category the Else should get run – but it isn’t. Been trying to figure it out all day!

Cheers, Lee

<code>
<txp:if_section name=”,en”>
<txp:if_category name=“Home,About,Contact”>
<txp:article />
</txp:if_category>
<txp:if_category name=“News”>
<txp:article listform=“news” />
</txp:if_category>
<txp:if_category name=“Events”>
<txp:article listform=“events” />
</txp:if_category>
<txp:else />
<txp:article_custom id=“3”>
</txp:if_section>
</code>

Offline

#2 2006-01-08 22:30:37

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

Re: If_section Else not working as expected

lee wrote:

and as there is no category the Else should get run – but it isn’t.

What txp:else is saying in your code is this: “if we’re not in section default or in section en”. If I understand you correctly and you want to say “if we’re in section default or in section en, but not on a category page”, you’d better use something like this:
<code>
<txp:if_section name=”,en”>
<txp:if_category name=“Home,About,Contact”>
<txp:article />
</txp:if_category>
<txp:if_category name=“News”>
<txp:article listform=“news” />
</txp:if_category>
<txp:if_category name=“Events”>
<txp:article listform=“events” />
</txp:if_category>
<txp:if_category>
<txp:else />
<txp:article_custom id=“3”>
</txp:if_category>
</txp:if_section>
</code>

Offline

#3 2006-01-08 23:11:50

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: If_section Else not working as expected

Many many thanks, it’s working now.

Offline

Board footer

Powered by FluxBB