In Web2py I am creating some email templates and want to include the tag with my css file LOAD’ed into the view.
How do I use the LOAD function in the view so that it doesn’t use jquery as it is an email and pulls from static, css, base.css.
This is what I have now:
<link href="{{=URL('static', 'css/style.css', scheme='http')}}" rel="stylesheet" type="text/css" />
But with this requires that remote content be loaded and most email applications disable this loading.
I was wanting to do this:
{{=LOAD(url=URL('static', 'css/style.css', scheme='http'),ajax=False)}}
But it is returning this:
<script type="text/javascript"><!--
web2py_component('http://127.0.0.1:8000/iid_app/static/css/web2py.css','c382784163112');
//--></script><div id="c382784163112">loading...</div>
<script type="text/javascript"><!--
web2py_component('http://127.0.0.1:8000/iid_app/static/css/style.css','c3845864949');
//--></script><div id="c3845864949">loading...</div>
Any ideas on how to make this just include the test from the file?
If you want to include the content of a CSS file in the email template, just add the following to the template where you want the CSS included:
The
{{include}}directive looks for the template to be included relative to the application’s “views” folder, so the “../” goes up one level from there in the folder structure, and from that point, you can just specify the path to the file you want to include.