On Wednesday, August 3, 2011 5:22:18 AM UTC-4, Web2Py Freak wrote: 
>
> hello guys , 
>
>  can you show me the way of adding a css file in web2py  i trying to 
> add one and its not working   !! help

 
Assuming you're using the 'welcome' app folder structure, put the file in 
/yourapp/static/css, and then link it in the head of your layout view as 
follows:
 
<link href="{{=URL('static', 'css/yourfile.css')}}" rel="stylesheet" 
type="text/css" />
 
 
Alternatively, if you're using web2py_ajax.html (which is included in the 
layout.html head of the 'welcome' app), anywhere in your code (model, 
controller, or view), you can do:
 
response.files.append(URL('static', 'css/yourfile.css'))
 
 
The web2py_ajax.html code links all the response.files (which can be css or 
js files) in your layout.html head.
 
Anthony

Reply via email to