>
> {{response.files.append(URL(r=request,c='static',f='/js/d3.js'))}}
>
{{extend 'layout.html'}}
>

That way, the script is only added for the current action (the function 
requested by the client), saving client resources

Another way would be adding them conditionally per-controller/function

(model code)
if request.controller in ("d3", "plot"):
    response.files.append(...)

(controller code)
if not request.function in ["about", "index", "contact"]:
    response.files.append(...)

There is detailed information on static files and the layout in the book

http://www.web2py.com/books/default/chapter/29/05#Page-layout


-- 



Reply via email to