[pmwiki-devel] Nested IF conditions

Petko Yotov 5ko at 5ko.fr
Fri Jun 19 23:49:48 CDT 2009


On 6/20/2009, "DaveG" <pmwiki at solidgone.com> wrote:
>After 4 hours debugging I discovered what I think is a bug if the
>conditional logic. Or perhaps nested conditions work differently to how
>I'd expect -- if so, how do I accomplish .
>
>(this was tested on pmwiki.org)
>
>This markup:
>    (:if equal 1 2:)111(:if equal 2 3:)222(:else:)333(:if:)444(:if:)
>
>produces: 333444
>expected: no output
>odd: 444 is shown, but 111 is not
..
>Which seems to indicate nested else conditional markup is simply
>ignored, or that the 444 is throwing things off.

Yes, nested conditions work differently to how you expect.

(:if:) works the same way as (:div:) and (:table:) and (:if:) is a
shortcut for (:ifend:)(:if:). To have nested conditionals (or divs) you
need to use a number:
  (:if equal 1 2:)111(:if2 equal 2 3:)222(:else2:)333(:if2:)444(:if:)

I see this is not yet explained in the documentation, it should be, since
we're out of beta now. I'll try to update it later today or tomorrow.

Thanks,
Petko




More information about the pmwiki-devel mailing list