velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Dekany <ddek...@freemail.hu>
Subject Re: The Guardian website moves to Velocity
Date Fri, 11 May 2007 14:43:07 GMT
Friday, May 11, 2007, 2:51:36 PM, Townson, Chris wrote:

[snip]
> --- in the main "view" template ---
>
> #component("MyComponent", {"id":$myComponent.id}) ## the webapp is
> still responsible for pushing the id of the component you want to
> display into the view (amongst other data, in all probability)
>
> --- end ---
>
> ... but we can have an entirely independent "component template"
> that makes the most of the beautiful simplicity of VTL and simply
> displays the properties of an object (info about which the template authors can obtain
from javadoc)!
>
> --- component template ("MyComponent.vm") ---
>
> <h1>${this.heading}</h1>
> <p>${this.text}</p>
>
> --- end ---
[snip]

How a real-world page template looks like there? A bouncy of
#component-s? Can you copy-pase a few real pages? I wonder what is if
components encapsulate other components and like. If you need any kind
of template language to build that component tree at all.

> 2. (And this is the main reason) Because Velocity explicitly does
> not attempt to be a solution which bundles everything and the
> kitchen sink. The clear delineation of responsibility (basically,
> taking a context+template and rendering) combined with clear
> extension points and an elegant syntax made it ideal for our
> purposes.

Based on what I understand from your system, you need a template
language only for some very trivial templating tasks, and then it
really doesn't mater which template engine you are using, so I won't
start debating if you have to face more complexity or less points of
extension with FreeMarker. Well, I think you wouldn't, but whatever.
However, I don't understand the "elegant syntax" part. I would think
that that:

  #component("MyComponent", {"id":$myComponent.id})

is rather less elegant than more elegant than:

  <@component "MyComponent", id=myComponent.id />

Not to mention (that I'm not sure is possible with your system, as I'm
not sure what the first parameter means):

  <@MyComponent id=myComponent.id />

where the "MyComponent" is a variable in the context.

And

  <h1>${this.heading}</h1>

is exactly the same with FreeMarker as well. So...

-- 
Best regards,
 Daniel Dekany


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message