I've just started using template inheritance (nice) and I have some
include files that I've placed in a common base.  These are things you
would see in the head of an html file like css and js files, for
example:

<script src="media/js/mootools/mootools.svn.js" type="text/javascript"></script>

The files are statically served by Apache. All is working well, except
some of my templates are in different folders in a directory
structure.

f1
template1.html
|_____f2
          |____template2.html
          |____template3.html

When the pages are rendered, the media directory is rooted at the
subfolder instead of the root folder.  Therefore the css and js files
are not detected unless the templates reside at root.  One solution
would be to serve all templates out of the top directory.  But of
course I don't want to do that.  Another solution would be to provide
a complete URI in the src tag:

<script src="http://mytestsite/js/mootools/mootools.svn.js";
type="text/javascript"></script>

But I don't want to do that either.

Yet another solution is to provide a different relative path depending
on which directory my page is served from.

<script src="media/js/mootools/mootools.svn.js" type="text/javascript"></script>
<script src="../media/js/mootools/mootools.svn.js"
type="text/javascript"></script>
<script src="../../media/js/mootools/mootools.svn.js"
type="text/javascript"></script>

Perhaps there is a template tag that allows something like this?
<script src="{{ webroot }}media/js/mootools/mootools.svn.js"
type="text/javascript"></script>

I see the MEDIA_URL variable in settings.py, however this doesn't seem
to be relevant here, thought there is not much in the documentation
about this.

Any ideas?  Did I miss the obvious solution?
--
Devin

--~--~---------~--~----~------------~-------~--~----~
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