[Helma-user] Template.js for Browser, Rhino and Helma

Juerg Lehni juerg at scratchdisk.com
Sun Apr 22 07:40:10 CEST 2007


I just uploaded new versions of Template.js, which include some bug  
fixes, but most of all now offer the possibility to be used in the  
browser too. There is also a version that can be used in a general  
Rhino based environment, without the Helma additions.

A simple example in the browser would then look like this:

---

// Copy over the renderTemplate method from Template.methods...
var renderTemplate = Template.methods.renderTemplate;

var template = new Template("<%foreach $value in param.values %>Hello  
<%= $value %>, <% param.message %><br /><% end %>");

alert(renderTemplate(template, {
	values: ["Browser", "Rhino", "Helma"],
	message: "Isn't this great?"
}));

---

I hope this is usefull for some of you.

Jürg


More information about the Helma-user mailing list