On 18.01.2009, at 1:11, Gaspard Bucher wrote:

> My templates contain an "include" tag (<r:include
> template='Node'>...</r:include>) that needs to grab more template text
> so I need to have access to the controller (or another context saavy
> thing). How should I implement this ?
>
> I saw that the concat_* thing gets a binding, but I don't understand
> very well what it's role is.


When you run merb (command line tool) and framework boots, templates  
are compiled. Compilation means turning
of a template into Ruby code that takes a binding and returns  
resulting string. Merb then defines methods on Merb::InlineTemplate
module for each template. That is, each template rendering is just a  
method call in Merb, and that's why it is fast, and also may utilize
method caching of virtual machines that provide it.

For the same reason if your template has a syntax error, Merb won't  
boot. Merb does not know anything about your template engine
functionality, so include tag is up to your engine, just return a  
properly compiled template to Merb so it can turn it into method.

Method names are "escaped" absolute paths like this:

__Users__antares__dev__merbapp__app__views__experiments__show__html__haml

but this does not make any difference for template handle author, just  
for your information.

MK


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to