Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How to identify the default (unset) category
Hi all,
one thing really annoys me in my current txp project: I’m unable to use if_category to identify the default, i.e. “unset” category. Background: I’d like to use a special code snippet for the homepage, and I’d like to identify such a request by checking if a category is set (which would be the case for all other pages except the homepage).
For example, if you hit the start page, I’d like to display the article list in a special format. On other pages, another article listing will be used. Now, there doesn’t seem to be a way to use <txp:if_category>
in a negation, e.g. <txp:if_category name="!">
or something similar. Also, the construct <txp:if_category> ... <txp:else />
doesn’t work AFAICT.
As a workaround, I used the mdm_if_category
plugin, which allows expressions like category="!"
to catch the unset category of the homepage and works fine, but can’t be nested properly or used with else
clauses, like it’s possible with txp:if_category
. So, I wonder if there’s built-in support for this kind of requirement. Does anyone know?
Thanks for your help!
Offline
#2 2006-04-29 15:29:36
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How to identify the default (unset) category
<code><txp:if_category>
<txp:else />
here your code
</txp:if_category></code>
Offline
Re: How to identify the default (unset) category
Argh. It seems I just forgot the slash in </txp:if_category>
. I’m so stupid, someone please shoot me. :(
Sorry for that, and thanks Els. I owe you one.
Offline