On 11/06/2006, at 18:04, Arnold wrote:

>
> Dear All,
> I have not found how to set up std.tg_js variable
> I suppose it shall be set to the path where is located the MochiKit
> library (relative to the project root directory) (<script
> src="${std.tg_js}/MochiKit.js"/>)
> May be I am missunderstanding something ??

std.tg_js points to the turbogears static files directory which is at  
turbogears/static. Mochikit.js lives in turbogears/static/js/ 
Mochikit.js so you should write.

<script src="${std.tg_js}/js/MochiKit.js"/>

Alternatively, if you need mochi in all pages, you can set the config  
variable tg.mochikit_all to True so it gets automatically included in  
all pages.

Another way would be to return the mochikit JSLink widget in the dict  
you return from your controller to the template engine:

from turbogears.widgets import mochikit

def controllermethod(....)
        return dict(
                foo = bar,
                mochi = mochikit,
        )

This last trick takes advantage of the machinery TG widgets use to  
pull all their required JS and CSS links into the template, it's the  
preferred method IMO as if, by any chance, mochikit's js file path  
changes inside TG, you won't need to update your code.


HTH,
Alberto


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to