Hi,
What I do is put an empty {% block extrahead %}{% endblock %} and {% block
extrastyle %}{% endblock %} in my base.html.  Then in any specific template
that extends base or base_site, I can fill in those blocks with {% block
extrastyle %}<script ... ></script>{% endblock %}.  Otherwise it will be
served up blank.

Hope that helps,

  -- Scott

On Mon, Sep 8, 2008 at 6:47 AM, Bobo <[EMAIL PROTECTED]> wrote:

>
> Hi everyone,
>
> I've a question about loading CSS and JS files. The normal command for
> doing so is:
>
> <link rel="stylesheet" type="text/css" href="/site_media/css/
> MY_CSS_FILE.css" />
> <script type="text/javascript" src="/site_media/js/MY_JS_FILE.js"></
> script>
>
> I'm doing that in my Base.html because it's the only HTML file which
> contain a <head></head> tag.
>
> All the other templates just extend that.
>
> My question now, is there any way that I can make some kind of
> template specified CSS/JS links?
>
> For example; I've a template called addactivity.html where it is
> possible from a form to submit a new activity. I've used some AJAX, a
> special CSS form file and a JS file. It is the only template I'm using
> the JS file and the CSS file. In my Base.html I'm currently importing
> about 7-8 CSS files and about 4-5 JS files. That is of cause silly
> since some of them only are used once or twice.
>
> Can I load the files in the specific template or can I somehow dictate
> base.html to only load some files when one template is active and
> another file with the next template and so on.
>
> Thanks
> Bobo
> >
>


-- 
http://scott.andstuff.org/ | http://truthadorned.org/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to