You could use the has_content built-in.  See
http://freemarker.org/docs/ref_builtins_expert.html

--David

Will Scheidegger wrote:
>
> Dear Magnolians
>
> Since everybody @ Magnolia seems to be that much fond of Freemarker
> we're trying not to swim too much against the current. I'm having one
> very annoying problem  though - I often get error messages like this:
>
> Expression cart.billingAddressCompany is undefined on line 19, column
> 11 in ch/fastforward/sfgb/mailtemplates/shopConfirmationMail_de.txt.
> The problematic instruction:
> ----------
> ==> ${cart.billingAddressCompany} [on line 19, column 9 in
> ch/fastforward/sfgb/mailtemplates/shopConfirmationMail_de.txt]
> ----------
>
> Java backtrace for programmers:
> ----------
> freemarker.core.InvalidReferenceException: Expression
> cart.billingAddressCompany is undefined on line 19, column 11 in
> ch/fastforward/sfgb/mailtemplates/shopConfirmationMail_de.txt.
>     at
> freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
>     ...
>
> Now if I place every ${myVar} in a <#if
> cart.orderAddressMobile??>...</#if> things would be fine, but isn't
> there a simple way to do this? Is there a setting or something that
> simply does not print out anything if the var is not defined? I'm sure
> I _must_ be missing something, because this works like a charm in JSP...
>
> Thanks for the insight.
>
> -will
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
>


-- 
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4334


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to