Look at the way index.html (from the welcome app) handles 'message':
{{if 'message' in globals():}}
<h3>{{=message}}</h3>
I'd suggest you do something similar (although I would do it with the main
layout file (presumably layout.html):
{{ if additional_js in globals(): }}
< code to include your JS ref>
Then in your controller actions make sure you set 'additional_js' in the
dict that you pass. Just one suggestion among the many possibilities..
I hope it helps..
On Thursday, July 12, 2012 9:49:44 PM UTC-5, MichaelF wrote:
>
> I want to include a JavaScript file, but only for certain views. What's
> the best way to include it? Do I have the controller append it to the
> response.files property? Do I simply use the <script> with "src=..."
> somewhere in the view? Something else?