Helma Logo
main list history
previous version  overview  next version

Version 2 by tobi on 05. October 2006, 22:21

Developing the first version of Rabbit, a little idea came into my mind which suddenly opened a door for very even more comfortable skin rendering.

I added a method called <code>render()</code> which mainly is wrapping renderSkin(). However, it takes a string as third argument:

function render(skin, param, str) {
    renderSkin(skin, param);

This string is used as name for a property of res.handlers.rendered
the rendered skin will be assigned to:

function render(skin, param, str) {
    if (str) {
      var result = this.renderSkinAsString(skin, param);
      res.handlers.rendered[str] = result;
      return result;
    } else {
      renderSkin(skin, param);

(Moreover, it returns the rendered skin as result.)

This way, I now can do the following with render():

// directly output a rendered skin as usual
// assign a render skin to a variable
var bar = render("foo", "foobar");
// use the "rendered" handler as container of previously rendered skins
render(createSkin("<% rendered.foobar %>"));