You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Darin Kelkhoff <da...@sportingnews.com> on 2001/11/20 20:50:24 UTC
silent notation
dear list,
is there anyway to adjust the behavior of silent notation? i ask because
we've often in the past (not with velocity yet) had the problem of where we
are displaying a table, and if there are no contents within a cell, the
bgcolor of the cell doesn't show up (in some browers, at least), so we always
show a <BR> or a in the case that a value does not exist where we're
showing it in a <td>.
i'm digging the silent notaion of velocity, so i don't have to write if/else
structs to hide a variable with no value, but i'm wondering if it (silent
notaition) could be set up to output somethign like a <br> or
(whatever i spec'ed it to be in the properties file)...
for example, id use it like this:
<td class=c1>$!foo.bar</td>
so that if $foo.bar was null, i would get the result
<td class=c1> </td>
instead of
<td class=c1></td>
so that our styles (bgcolor) would still take effect inside the td. i
imagine it could have other useful applications in other useful applications.
does somethign like this already exist that i'm just missing? is it
something others might find useful?
thanks,
--darin
--
Darin Kelkhoff
darink@sportingnews.com
Programmer
The Sporting News
www.sportingnews.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: silent notation
Posted by Nathan Bubna <na...@esha.com>.
yeah, this was an issue for me some time back...
what's worked (most of the time) for us is to use a velocimacro...
#macro( loudnull $a)
#if($a)#if ($a != "")$a#else--#end#else--#end
#end
where #loudnull($somenullreference) outputs '--'
there has been some past weirdness about how variables passed as arguments
to a macro test in the #if() statement (esp. in $validRef.thisReturnsNull
situations), but i don't remember where that's at. there was some talk of a
future null token to make the #if behaviour clear, but i don't think that's
happened yet. anyway, try that out and see if it works for you.
Nathan Bubna
nathan@esha.com
----- Original Message -----
From: "Darin Kelkhoff" <da...@sportingnews.com>
To: <ve...@jakarta.apache.org>
Sent: Tuesday, November 20, 2001 11:50 AM
Subject: silent notation
> dear list,
> is there anyway to adjust the behavior of silent notation? i ask because
> we've often in the past (not with velocity yet) had the problem of where
we
> are displaying a table, and if there are no contents within a cell, the
> bgcolor of the cell doesn't show up (in some browers, at least), so we
always
> show a <BR> or a in the case that a value does not exist where
we're
> showing it in a <td>.
>
> i'm digging the silent notaion of velocity, so i don't have to write
if/else
> structs to hide a variable with no value, but i'm wondering if it (silent
> notaition) could be set up to output somethign like a <br> or
> (whatever i spec'ed it to be in the properties file)...
>
> for example, id use it like this:
>
> <td class=c1>$!foo.bar</td>
>
> so that if $foo.bar was null, i would get the result
>
> <td class=c1> </td>
>
> instead of
>
> <td class=c1></td>
>
> so that our styles (bgcolor) would still take effect inside the td. i
> imagine it could have other useful applications in other useful
applications.
>
> does somethign like this already exist that i'm just missing? is it
> something others might find useful?
>
> thanks,
> --darin
>
> --
> Darin Kelkhoff
> darink@sportingnews.com
> Programmer
> The Sporting News
> www.sportingnews.com
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: silent notation
Posted by "Henning P. Schmiedehausen" <ma...@hometree.net>.
Darin Kelkhoff <da...@sportingnews.com> writes:
>we've often in the past (not with velocity yet) had the problem of where we
>are displaying a table, and if there are no contents within a cell, the
>bgcolor of the cell doesn't show up (in some browers, at least), so we always
>show a <BR> or a in the case that a value does not exist where we're
>showing it in a <td>.
>i'm digging the silent notaion of velocity, so i don't have to write if/else
>structs to hide a variable with no value, but i'm wondering if it (silent
>notaition) could be set up to output somethign like a <br> or
>(whatever i spec'ed it to be in the properties file)...
I use a simple pull tool for doing exactly this (in Turbine):
--- cut ---
import org.apache.ecs.html.Entities;
import org.apache.turbine.services.pull.ApplicationTool;
public class CellTool implements ApplicationTool
{
public String getCell(String c)
{
if("".equals(c))
return Entities.NBSP;
else
return c;
}
}
--- cut ---
(and tool.global.cell = de.intermeta.toolbox.CellTool
in TurbineProperties. ;-) )
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH hps@intermeta.de
Am Schwabachgrund 22 Fon.: 09131 / 50654-0 info@intermeta.de
D-91054 Buckenhof Fax.: 09131 / 50654-20
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>