Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.4
About It:
Get it:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

mdm_if_category

This plugin is used as such:

<txp:mdm_if_category category="..."> stuff goes here </txp:mdm_if_category>

The category attribute is optional. If missing, the stuff always shows.
If category is the empty string “", the stuff shows only if no category is current for the page.
If category is some other string, the stuff shows only if the current category name matches.

It’s simply a string based comparison, so it will probably break when true hierarchical categories are available; I’ll have to fix it then.

Here’s an example to give you a better idea of how it might work on a page:

    <ul>
        <txp:mdm_if_category>
            <li>will always display</li>
        </txp:mdm_if_category>
        <txp:mdm_if_category category="">
            <li>displays only if no category selected</li>
        </txp:mdm_if_category>
        <txp:mdm_if_category category="Mass Transit">
            <li>displays only if Mass Transit category selected</li>
        </txp:mdm_if_category>
        <txp:mdm_if_category category="vx">
            <li>displays only if vx category selected</li>
        </txp:mdm_if_category>
    </ul>

this plugin has since been adopted and can be found at gho_if_category

Article Request Count:
Initially released:
2004-05-27
Posted here:
21 Feb 2005
Article modified:
02 Nov 2006

You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (4)

FYI, user graumeister (http://forum.textpattern.com/profile.php?id=3747) is taking ownership of this plugin.
...this plugin link seems to be dead.
this plugin is obsolete since there is an internal version of if_category available. the old version of the plugin can be found here

I don’t think it’s obsolete as the built-in functionality in TXP doesn’t have a negation option IMHO (especially not for “no category selected” = homepage). I find this plugin to be extremely useful.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern