Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.3b
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 2 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!

ptv_if

Had the need for a proper conditional statement the other day; the "else" part of it to be specific. As I didn't feel that creating a plugin checking for a negating condition, I instead wrote a quick conditional construct.

So...basically this is an if / else if / else tag that can be applied on already existing plugins and functions. It is made up of one "parent" tag inside which the conditions are written.

Example:

<txp:ptv_condition>
<txp:ptv_if plugin="mdm_if_category" category="Alpha"> Content specific to Alpha category </txp:ptv_if> <txp:ptv_else> Content for everything else </txp:ptv_if> </txp:ptv_condition>

It also has support for 2 part comparisons of accessible variables, functions or absolute values, although I havent tested that part thoroughly and it currently uses eval() which is a potential security hazard when combined with user input.

The else_if part is purely decorative as if can be used in its place just as well.

My todolist is:

  • Nested statements.
  • Singular boolean tests.
  • Proper comparisons with and, or, xor, groupings.
  • A way to use the plugins in a bit more elegant way.

Best regards
Borisch a.k.a. Petur

Article Request Count:
Initially released:
2005-03-21
Posted here:
21 Mar 2005
Article modified:
16 Mar 2008

If there is a comment form at the Information URL, you may want to leave your comments/questions there or 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 (5)

working successfully for me on RC3 :)
Good to hear.
Report any problems and I’ll get on them.
the download is dead?

The link is not working? Wtf?

Sorry about that guys and gals.
Did some remodelling on my site some time ago and didn’t realise that I killed the code folder. It’s up and running again.

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

Would you care to write a comment or visit the forum discussion?

You know you want to visit the Archives.

Browse

Categories


Articles

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