[pmwiki-users] no ifs, ands, buts, or else ...

Neil Herber nospam at eton.ca
Thu Mar 23 16:59:55 CST 2006


At 2006-03-23  02:48 PM -0600, Patrick R. Michaud is rumored to have said:
>On Thu, Mar 23, 2006 at 03:37:39PM -0500, Neil Herber wrote:
> > Do my eyes deceive me?
> > http://www.pmwiki.org/wiki/PmWiki/ConditionalMarkup
> >
> > ... or is there really no (:else if:) or (:else:) construct? It looks
> > like the (:if:) as implemented is a variation of  the SSI show and
> > hide directives (though not implemented that way).
>
>There's currently no (:else if:) or (:else:) construct.  Part of the
>reason is that having one would make people expect nested if's.
>
> > It is a pain to have to write
> > (:if cond-a:)  show a
> > (:if cond-b:)  show b
> > (:if cond-c:)  show c
> > (:if cond-d:)  show d
> > (:if expr !cond-a or !cond-b or !cond-c or !cond-d:) show something else
> > (:if:)
>
>Are cond-a, cond-b, cond-c, cond-d mutually exclusive above?
>Or did you really mean to "show something else" if any of
>a, b, c, or d aren't true?  (This isn't how I would expect an
>"else" to work.)
>
>Or, put another way -- how would you write the above assuming
>you did have (:else:) and/or (:elseif:)?
>
>Pm

I don't think it's fair to expect coherent examples from the 
frustrated, but I digress ....  ;-)

How about:
(:if name=dick:)  Hello young fellow
(:if name=jane:)  What's a nice girl like you doing here
(:if expr !name=dick or !name=jane:) Spot, is that you?
(:if:)

which could be:
(:if name=dick:)  Hello young fellow
(:elseif name=jane:)  What's a nice girl like you doing here
(:else:) Spot, is that you?
(:if:)

At first I thought that a series of "ifs" were the same as an "if" 
followed by "elseifs", but they are not. I'm sure you knew that. It 
just took a while to sink in here. I can now see why nesting would be 
the next feature creep requested.



Neil

Neil Herber
Corporate info at http://www.eton.ca/
Eton Systems, 15 Pinepoint Drive, Nepean, ON, Canada K2H 6B1
Tel: (613) 829-4668 





More information about the pmwiki-users mailing list