I'm afraid I don't quite understand all of your question, but I can
possibly answer part of it, although please bear in mind I'm quite new
at Django, so there may be better ways of doing it.

On May 19, 11:50 am, sebey <[EMAIL PROTECTED]> wrote:
>
> I am thinking about making a template that has the sturcture and and
> have a css template with the background color as a variable is this
> possible basically all the shows come form this template  and css
> file
>
As far as I know, CSS files can't have variables or constants defined
within them. To have different colour backgrounds, my first approach
would be simply to have different CSS files, e.g. base_red.css,
base_green.css, etc. This is an approach I am currently using in a
development I am doing, however, the drawback is obviously going to be
the ongoing maintenance of two or more CSS files which need to be
identical apart from one or two lines defining the colour. Probably
not a tremendous problem if it is ONLY the background colour which
needs to change... The applicable CSS file to be used can be defined
using the template system: in my base.html (which defines to overall
structure of all subordinate pages) I have the following line:

(in the <head>.....</head> block):     <link rel="stylesheet" href="../
stylesheets/{{style}}.css" type="text/css">

The variable {{ style }} can be defined in the URL, or maybe in the
GET data (eg www.<somesite>.com/?style=red), or anywhere you like.

This worked fine for me, because I am using it to define more than
just the background colour, but also to radically change the layout of
the page, such as fonts, borders, graphics, element positioning etc.

However the next stage might be, to have more than one stylesheet for
the page... I think this would work fine for just background colour
changes, for example:

Style sheet red.css:
body {background-color: #FF0000;}

Style sheet green.css:
body {background-color: #00FF00;}

Style sheet base.css:
All the other stuff!

base.html:
<head>
     <link rel="stylesheet" href="../stylesheets/{{style}}.css"
type="text/css">
     <link rel="stylesheet" href="../stylesheets/base.css" type="text/
css">
</head>

I haven't tried this yet, but I think it would work.

The third thought to occur to me was to use JavaScript (or something)
to directly modify the DOM model, however at this stage the learning
curve seem too scary to me, however it might actually be the best way
in the end, if the variations in styles become too complex.

> not to mention can you load a template with in a template like have
> the homepages with templates inside them?
>
Well, yes I think so... I'm not sure why you think that would not be
possible, have you had a problem with it, or am I misunderstanding
your question?
--~--~---------~--~----~------------~-------~--~----~
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