On Monday 26 October 2009 15:10:08 [email protected] wrote:
> Hello,
> i have a question regarding py:match in Master.html.
>
> my Master header looks like this:
>
> <head py:match="head" py:attrs="select('@*')" >
>       <script src="/js/jquery.js"></script>
>     <meta content="text/html; charset=UTF-8" http-equiv="content-type"
> py:replace="''"/>
>     <title py:replace="''">Taboo</title>
>     <link rel="stylesheet" type="text/css" media="screen" href="$
> {tg.url('/css/style.css')}" />
> </head>
>
>
> in one of the templates i render a tw.jquery.autocomplete that
> includes its own jquery.js so the result looks like this:
>
> <head>
> <link rel="stylesheet" type="text/css" href="/toscawidgets/resources/
> tw.jquery.autocomplete/static/css/jquery.autocomplete.css"
> media="all" />
> <script type="text/javascript" src="/toscawidgets/resources/
> tw.jquery.base/static/javascript/jquery-1.3.2.js"></script>
> <script type="text/javascript" src="/toscawidgets/resources/
> tw.jquery.base/static/javascript/jquery.dimensions.pack.js"></script>
> <script type="text/javascript" src="/toscawidgets/resources/
> tw.jquery.base/static/javascript/jquery.bgiframe.js"></script>
> <script type="text/javascript" src="/toscawidgets/resources/
> tw.jquery.direction/static/javascript/jquery.direction.js"></script>
> <script type="text/javascript" src="/toscawidgets/resources/
> tw.jquery.autocomplete/static/javascript/jquery.autocomplete.js"></
> script>
>
> <!-- overwrites the tw settings -->
> <script src="/js/jquery.js"></script>
>
> <link rel="stylesheet" type="text/css" media="screen" href="/css/
> style.css" />
> </head>
>
>
> as you can see the <script src="/js/jquery.js"></script> in Master
> overwrites the tw includes.
> How i can solved this issue ?
> Basically i need to include jquery in every page but without rewriting
> the includes from templates and widgets.

There are various options here, the IMHO best one being to make whatever you 
have in the master-template that requires jquery to be a widget itself - and 
simply render that there. You can stuff it into the app-globals so that you 
don't have to put it into the tmpl_context in each controller.

Another option would be to put a 

 from tw.jquery import jquery_js
 
 ...
 def something_thats_called_on_each_request():
       jquery_js.inject()

somewhere where each request passes by - the myproject.lib.base 
controller-class might be one such option, or a variable-provider. 

Diez

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to