velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leos Literak <>
Subject Re: summary table of velocity reflection?
Date Sat, 10 Aug 2002 11:38:57 GMT
>> public constructors, with args:
>>  not available
>>  workaround: add a public static method to the class or a helper class
> Yep - the idea is to provide all the objects necessary for the designer, not
> let them create them.

Generally I agree. But see my example:

in the template I want to display the freshest
titles of articles on different servers.

* Article 1
* Article 2

Linux PR
* PR article 1
* PR article 2

and so on.

I fetch this data into class Server (simplification)
There are currently 6 newest articles for many servers.
But in the template, which is displayed on every
page I choose, which servers gets diplayed and how
many titles will appear there.

So I use this:



#foreach($server in $servers)
#foreach($link in $links)
<TD><A CLASS="menu" HREF="$!link.Url">$!link.Text</A></TD>

So I instantiate variables in template (when I am in role
of designer :-), but I do designer's job. Such limitation
of data is IMHO responsability of designer. I cannot imagine,
that I had to recompile classes, whenever I decide to
stop displaying titles of some server.

Yes, it would be nice to have other solution
that I presented there. Something like
#set($tmp=[5 1])

but when I implemented this part, I had some issues
with arrays (dont remember what kind of).

So if there would be kind of nice way how to
instantiate objects (with or without parameters),
I would be very happy :-)


Leos Literak - tady je tucnakum hej!

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message