velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Esposito" <espos...@newnetco.com>
Subject VTL syntax
Date Wed, 21 Feb 2001 18:33:18 GMT
me again ... ;)

here's what I want to do ... I want to have a section of text change color
based on a variable in the context ... so something like this

if the Error variable is set, print:

	<FONT color="red">

else, print:

	<FONT color="black">

end if


The way i've implemented this before in languages such as cold fusion are as
follows

<FONT color="<CFIF IsDefined("Error")>red<CFELSE>black</CFIF>">

yah, a little hacky but i like it ... in VTL, however, since there are no
delimiters for keywords except whitespace, i can't do it ... If i try:

<FONT color="#if($Error)red#elseblack#endif">

it just plain doesn't work ... i tried the following, it evaluates correctly
but the fact that there is a leading space in the color="" value causes the
browser to not render the font the way I want it ...

<FONT color="#if($Error)red#else black#endif">

any suggestions? any chance that you could add an optional semicolon
delimiter or something to the keyword so that I can inline it without having
to use whitespace to seperate it out?

thanks in advance ..

-dave


Mime
View raw message