velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: VTL syntax
Date Wed, 21 Feb 2001 21:14:24 GMT
David Esposito wrote:
> 
> yes yes yes ... that's probably what i'll end up using ... ;) ... i just
> like to torment people a bit ... :)
> 
> (btw, is there a way to do this with a velocimacro? ... like the IIF()
> function that steve suggested a few messages ago)

Here's a quickie. Should work :

#macro( iif $val $tr $fal)
#if($val)${tr}#else${fal}#end
#end

Test :
>#iif( true "a" "b")<

geir

> > -----Original Message-----
> > From: gmj@mta4.srv.hcvlny.cv.net [mailto:gmj@mta4.srv.hcvlny.cv.net]On
> > Behalf Of Geir Magnusson Jr.
> > Sent: Wednesday, February 21, 2001 3:49 PM
> > To: velocity-user@jakarta.apache.org
> > Subject: Re: VTL syntax
> >
> >
> > David Esposito wrote:
> > >
> > > hmm ... interesting that you didn't get a space ... i checked and I'm
> > > certainly getting the space ...
> > >
> > > here's a terrible terrible hack ... ;) ... it actually works ...
> > >
> > > <FONT color="#if($Error)red#else$!{dead}black#end">
> > >
> > > where the variable "dead" is not defined (not in the context)...
> >
> >
> > Ugh.
> >
> > Just for grins, what's wrong with :
> >
> > <FONT #if($Error) color="red" #else color="black" #end >
> >
> > ?
> >
> > geir
> >
> >

-- 
Geir Magnusson Jr.                               geirm@optonline.com

Developing for the web?  See http://jakarta.apache.org/velocity/

Mime
View raw message