You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Tim Colson <tc...@cisco.com> on 2002/06/22 03:19:01 UTC
Display List in Multiple HTML Columns Thread?
Ugh - I know this has been discussed. I searched mail-archive in
vain...and hey, the list has been pretty quiet of late, so why not just
ask. :-)
Would somebody please send a couple links to the discussion threads on
how to take a List and spit it out into multiple columns?
BTW- I threw together a quick and dirty method (shown below) that
iterates twice, displaying whichever 'half' it should. Not pretty, but
works.
I found it curious that the 'rithmetic and logic involving floats didn't
puke. I wonder if I should be nervous? ;-)
Thanks,
Tim
P.S. I still think '&' would be a fine char to use for concatenation
<grin>
## Show $list split into 2 columns, roughly half/half with a slight bias
to the left side
#set ($num_cats = $list.size())
#set ($half = $num_cats / 2)
<TR>
<TD><!-- col 1 -->
<TABLE>
#foreach ($category in $list)
#if ($velocityCount <= $half + 1)
<TR>
<TD> Item $category.name
</TR>
#end
#end
</TABLE>
</TD>
<TD> <!-- col 2 -->
<TABLE>
#foreach ($category in $list)
#if ($velocityCount <= $half + 1)
<TR>
<TD> Item $category.name
</TR>
#end
#end
</TABLE>
</TD>
</TR>
</table>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Display List in Multiple HTML Columns Thread?
Posted by Tim Colson <tc...@cisco.com>.
> > #if's, although the docs don't show '<=' or '>=' they seem to work.
> > Is this new in 1.3?
>
> I don't remember when they showed up, but I am almost 100%
> sure it was pre 1.0
Hmm, perhaps a quick update in the User-Docs would be appropriate?
http://jakarta.apache.org/velocity/user-guide.html#Conditionals
Cheers,
Tim
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Display List in Multiple HTML Columns Thread?
Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 6/22/02 6:25 PM, "Tim Colson" <tc...@cisco.com> wrote:
>> Hey that looks pretty good.
> Will was too kind. ;-)
>
>>> BTW- I threw together a quick and dirty method (shown below)
> Ugh... just in case anybody was copy/pasting like I did... the second
> col' comparison should of course been '>' instead of '<='.
>
> Which brought me to the manual to verify which operators are legal in
> #if's, although the docs don't show '<=' or '>=' they seem to work.
>
> Is this new in 1.3?
I don't remember when they showed up, but I am almost 100% sure it was pre
1.0
--
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Display List in Multiple HTML Columns Thread?
Posted by Tim Colson <tc...@cisco.com>.
> Hey that looks pretty good.
Will was too kind. ;-)
> > BTW- I threw together a quick and dirty method (shown below)
Ugh... just in case anybody was copy/pasting like I did... the second
col' comparison should of course been '>' instead of '<='.
Which brought me to the manual to verify which operators are legal in
#if's, although the docs don't show '<=' or '>=' they seem to work.
Is this new in 1.3?
Correction for Column #2:
> > <TD> <!-- col 2 -->
> > <TABLE>
> > #foreach ($category in $list)
> > #if ($velocityCount > $half + 1)
> > <TR>
> > <TD> Item $category.name
> > </TR>
> > #end
> > #end
> > </TABLE>
> > </TD>
> > </TR>
> > </table>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Display List in Multiple HTML Columns Thread?
Posted by Will Glass-Husain <wg...@forio.com>.
Hey that looks pretty good.
I did something similar that made a two column table going across instead of
down. I don't have the full code with me but it was something like:
<table>
#set ($OnLeft = true)
#foreach ($item in $List)
#if ($OnLeft ) <tr>
#end
<td>$item</td>
#if (!$OnLeft ) </tr>
#end
#set ($OnLeft = !$OnLeft )
#end
</table>
Quoting Tim Colson <tc...@cisco.com>:
> Ugh - I know this has been discussed. I searched mail-archive in
> vain...and hey, the list has been pretty quiet of late, so why not
> just
> ask. :-)
>
> Would somebody please send a couple links to the discussion threads on
> how to take a List and spit it out into multiple columns?
>
>
> BTW- I threw together a quick and dirty method (shown below) that
> iterates twice, displaying whichever 'half' it should. Not pretty, but
> works.
>
> I found it curious that the 'rithmetic and logic involving floats
> didn't
> puke. I wonder if I should be nervous? ;-)
>
> Thanks,
> Tim
> P.S. I still think '&' would be a fine char to use for concatenation
> <grin>
>
> ## Show $list split into 2 columns, roughly half/half with a slight
> bias
> to the left side
> #set ($num_cats = $list.size())
> #set ($half = $num_cats / 2)
> <TR>
> <TD><!-- col 1 -->
> <TABLE>
> #foreach ($category in $list)
> #if ($velocityCount <= $half + 1)
> <TR>
> <TD> Item $category.name
> </TR>
> #end
> #end
> </TABLE>
> </TD>
> <TD> <!-- col 2 -->
> <TABLE>
> #foreach ($category in $list)
> #if ($velocityCount <= $half + 1)
> <TR>
> <TD> Item $category.name
> </TR>
> #end
> #end
> </TABLE>
> </TD>
> </TR>
> </table>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
------------------------------------
Will Glass-Husain <wg...@forio.com>
Forio Business Simulations
office: (415) 440-7500
mobile: (415) 235-4293
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>