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.
<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.
Borisch a.k.a. Petur