[Developers] mjt.def

Nick Thompson nix at metaweb.com
Tue Jul 3 02:28:17 UTC 2007


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