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

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

mdn_if_custom

This plugin provides a number of conditional tests for custom fields. It will check for empty, notempty, equals, or notequals. It also includes an clause, so that the inverse of each test may have a false consequence as well.

example usage:

<txp:mdn_if_custom field="2" empty="1"> <else /> Author: <txp:rei_show_custom customid="2" /> </txp:mdn_if_custom>

…where if custom_field2 is empty, it will output nothing, and if custom_field2 is filled, it will print what is after the . In this case, since ‘Remillard’ was the etnry for custom_field2, it would print:

Author: Remillard

another example:

<txp:mdn_if_custom field="9" equal="author">by <txp:rei_show_custom customid="2" /> <else /> no author listed </txp:mdn_if_custom>

…where if custom_field9 is filled with the exact text “author”, then it will print
by <em>'name of author'</em>

but if custom_field9 is either empty OR filled with anything other than “author”, it will print

no author listed

Article Request Count:

Archived [?]: Built-in tag now exists: txp:if_custom_field

Keywords/tags:
Initially released:
2004-11-23
Posted here:
23 Nov 2004
Article modified:
20 Jan 2008

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 (3)

Hi,
why not use Textpattern’s original tag ‘if_custom’..., ?
:)

Actually, mdn_if_custom predates the built-in if_custom tag. There had been no custom-related conditions.. there had not even been a tag to display custom fields.

Now, of course there are. Sweet progress.

I still have mdn_if_custom installed on all my Textpattern sites. It works as beautifully as it always did, and I can nest in and and out of the ‘new’ built-in if_custom tags. The nesting is really useful.
not just the nesting, but the ability to identify custom fields by their IDs rather than name is essential for me.

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