Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-05-23 02:04:30

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

TXP Conditionals hack

Being one of those wishing the front page had a different section from the articles and so simplify the default template, I found my self wanting an if_not tag (eg <code><txp:if_not_section></code> and <code><txp:if_not_category></code>) as sometimes one wants an exclusion rather than inclusion rule.

I discovered with a little experimenting you can simulate the behaviour of if_not by the judicious use of <code><txp:else /></code>.

For example <code><txp:if_section name=“whatever”><txp:else /> . . . </txp:if_section></code> is functionally equivalent to <code><txp:if_not_section name=“whatever”> . . . </txp:if_not_section></code>. What makes this work is the empty clause between the if and the else tags.

I thought I’d post it here in case it’s of use to someone else who didn’t want to use a plugin for whatever reason..

Last edited by NyteOwl (2006-05-23 02:22:50)


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#2 2006-05-23 02:28:00

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: TXP Conditionals hack

This is in the FAQ.


Alex

Offline

#3 2006-05-23 15:30:17

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: TXP Conditionals hack

Ok thanks zem. I missed that though I thought that it must have either been intentional or discovered previously. Mea culpa :)


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

Board footer

Powered by FluxBB