[Helma-dev] Template Engines

Hannes Wallnoefer hannesw at gmail.com
Wed Nov 23 11:31:19 CET 2005


2005/11/23, Juerg Lehni <juerg at scratchdisk.com>:
> Another advantage of Rails seems to be the more flexible template
> engine that allows loops and if / else constructs in the templates
> (skins).

Well, what Rails does is basically the same as Helma's old .hsp, i.e.
embedding Ruby code in templates. I really thought it was a good thing
when we went over that. The critical question in this regard will be
how easy we can make it to implement macros in Helma 2.0.

> I was wondering how this will be adressed in Helma 2.0? There are
> powerfull Java libraries around for this, e.g. Velocity ( http://
> jakarta.apache.org/velocity/ ) and FreeMaker ( http://
> freemarker.sourceforge.net/ ).
>
> Hannes, are you considering embeding one of those, or will Helma
> feature its own engine, that might implement the programming
> constructs in a way that is closer to the JavaScript syntax?

I think it should be possible to use a third party templating engine
with Helma. There will be a proprietary implementation, though.

One current idea, pretty offhand, is to use custom markup tags or attributes:

<div h:foreach="storylist">
  <h3 h:content="story.title">Title</h3>
  ...
</div>

Explanation: If the h:foreach attribute evaluates to an array, the
inner skin is rendered on each array element. If statements could be
build in a similar fashion:

<div h:if="story">
    <h3 h:content="story.title">Title</h3>
  ...
</div>

As I said, I'm writing this offhand, we may already have done this
better somewhere on the mailing list.

> And is this something I could help with for 2.0?

Yes, of course you can. Keep having good ideas, try out things, start
using dev.helma.org wiki :-)

hannes

> Jürg_______________________________________________
> Helma-dev mailing list
> Helma-dev at helma.org
> http://helma.org/mailman/listinfo/helma-dev
>


More information about the Helma-dev mailing list