Geert Bevin wrote:
Note that by using getBlock everything is evaluated, even the placeholders that are filled in with the state information for the exits and the submissions. There's another method however, getDefferedBlock, that gives you all the individual content snippets.

What do you think of the idea of adding a convenience method, something like getRenderedBlock(), that does the "process a clone of the template" thing? I kind of expected there to be a method to do that already and was a bit surprised when getBlock() didn't, especially since the Javadoc sort of implies it will (or at least, that's how I read it.)

In this case I really did want everything fully filled in, placeholders included; I was actually transforming the block into a JavaScript string to assign to a variable so I could do something like

var text = <r:v name="renderedBlock">null</r:v>;
...
document.getElementById("foo").innerHTML = text;

Since the JavaScript transformation involved munging the contents of the block, e.g. putting backslashes in front of all the double quotes, I needed the fully rendered string rather than some intermediate form that would then be further processed by the template engine.

Later on, should it become commonly used, this getRenderedBlock() method could be optimized to only do the processing needed to render the particular block in question. But for a first cut it can just do the clone-and-process thing I'm doing.

-Steve
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to