Ooops.  My bad.  My actual non-working template had

#if ( !$foo )

The problem was extra spaces inside the parenthesis.  I assumed that
extra whitespace would be irrelevant and accidentally left it out of my
report.

"Geir Magnusson Jr." wrote:
> 
> "Geir Magnusson Jr." wrote:
> >
> > jeff wrote:
> > >
> > > I wanted to check in a template to see $foo was a valid reference.  I
> > > tried
> > >
> > > #if (!$foo)
> > >  stuff
> > > #end
> > >
> >
> > You would think this would be the right way.  Hm.  I'll take a look.
> 
> I must be missing something.  The following template :
> 
> #if (!$foo)
>  Hello
> #end
> 
> #set($bar = "woogie")
> #if(!$bar)
>   not bar
> #else
>   \$bar = $bar
> #end
> 
> produces the output
> 
>  Hello
> 
>   $bar = woogie
> 
> This seems right :)  Maybe I didn't understand your post...
> 
> geir
> 
> > > then i tried
> > >
> > > #if ($foo = null)
> > >  stuff
> > > #end
> > >
> > > then I tried
> > >
> > > #if ($foo)
> > > #else
> > >  stuff
> > > #end
> > >
> > > finally I suceeded with
> > >
> > > #if ($foo)
> > >
> > > #else
> > >  stuff
> > > #end
> > >
> > > Is there a more elegant solution?
> >
> > --
> > Geir Magnusson Jr.                               [EMAIL PROTECTED]
> > Velocity : it's not just a good idea. It should be the law.
> > http://jakarta.apache.org/velocity
> 
> --
> Geir Magnusson Jr.                               [EMAIL PROTECTED]
> Velocity : it's not just a good idea. It should be the law.
> http://jakarta.apache.org/velocity

Reply via email to