[Developers] mjt.def

Dae Park daepark at metaweb.com
Tue Jul 3 02:50:13 UTC 2007


I was thinking more along the lines of including a javasript library  
and maybe something similar could be applied to a library of mjt.def  
declarations.

Would you use a hidden frame to load your mjt.def declarations and  
have your visible (template) frame wait for it to load, set the  
mytemplate window variable and then call mjt.run on itself?





On Jul 2, 2007, at 7:28 PM, Nick Thompson wrote:

> Dae Park wrote:
> > Is there anyway to share "mjt.def" declarations across multiple  
> templates?
>
> in the most recent version of mjt, mjt.run() returns a javascript  
> object
> that contains all the toplevel mjt.def= declarations from the  
> template.
> so you can do:
>
> <THIS IS UNTESTED>
> <div id="mytemplate">
>   <div mjt.dev="mydef(arg1)">
>     <b>$arg1</b>
>   </div>
> </div>
> </THIS IS UNTESTED>
>
> then later, in js:
>   window.mytemplate = mjt.run('mydiv');
> then you can use something like ${mytemplate.mydef(...)} in other
> templates.
>
>     nick



More information about the Developers mailing list