Template compilation on boot is a nice feature but it won't work for
me since the templates can be edited through the web while the
application runs. You can even create new websites without rebooting.
This means that a solution could be to insert the compilation step
before render as:
render Zafu::template_for(...)
where "template_for" would take care of (re)building and would return
{:template => "path_to_template"}.
This could work but we need a way to tell every merb threads/processes
that this "path_to_template" is new or has changed and that the method
needs to be recompiled. Same goes for the partials generated during
compilation, but this means that:
1. I must have access to the method name builder ( Merb::Template.template_for )
2. I need to remove the path from Merb::Template::METHOD_LIST when the
template is edited
All this is fine except for (2): how can I make sure that the path is
removed from *ALL* instances of the merb application ? Shared memory ?
Gaspard
On Sat, Jan 17, 2009 at 11:40 PM, Michael Klishin
<[email protected]> wrote:
>
>
> 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
-~----------~----~----~----~------~----~------~--~---