Hi,
I'm wondering if it's possible to insert a UDT or a global content tag in a CSS sheet? (like the [[root_url]]
What i would like to do, is to define a few colors in a tag and then call them in my CSS sheets. It would be very useful then if i would like to change quickly the colors on a website for example.
like that:
.foo {
color: [[color-tag]]
background-color: [[color-tag-two]]
}
What would be the best way to do that?
thanks guys,
jd
[SOLVED] Dynamic tag in CSS?
[SOLVED] Dynamic tag in CSS?
Last edited by jd447 on Tue Feb 15, 2011 5:48 pm, edited 1 time in total.
Re: Dynamic tag in CSS?
I've never tried using a UDT or a GCB in a stylesheet, but what I do is add color definitions at the top of the stylesheet:
Then later on, I use those values:
This isn't really dynamic content, since they are defined at the top. I know that you can use some Smarty logic and control stuctures in these stylesheets, but I really don't understand how they are cached and have dynamic content at the same time. It just seems to work! ![Smiley :)](./images/smilies/smiley.gif)
Code: Select all
[[assign var="plum" value="#B58CB2"]]
[[assign var="cream" value="#FFF7DA"]]
[[assign var="rose" value="#FC5E72"]]
[[assign var="fudge" value="#7A3F28"]]
Code: Select all
h1 {
color: [[$fudge]];
}
![Smiley :)](./images/smilies/smiley.gif)
Re: Dynamic tag in CSS?
thanks! looking fwd to try.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: [SOLVED] Dynamic tag in CSS?
GCB's will work. However they will only be called when the .css file is being generated in the tmp/cache directory. And this only happens on the first request of a page using that stylesheet AFTER the stylesheet has been changed (or the cache cleared).
i.e: you can put [[global_content name='my_css_colors']] at the top of every stylesheet.
and that will work, and will be called exactly once for each stylesheet, and will not be called any more until either the cache is cleared, or the stylesheet is changed again.
i.e: you can put [[global_content name='my_css_colors']] at the top of every stylesheet.
and that will work, and will be called exactly once for each stylesheet, and will not be called any more until either the cache is cleared, or the stylesheet is changed again.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.