Page 1 of 1

[Solved]How to use {cms_stylesheet} ?

Posted: Mon Jul 19, 2010 11:11 am
by Yvan B
Hi there !

I've got the latest CMSMS version (1.8.1) and I wanted to use the new feature {cms_stylesheet} that makes variables available in the CSS files using [[$my_variable]].

I have two different templates: one for the public pages (which are greenish), another one for the member pages (which are redish). So I thought I should just define my colors in the header of my templates and use them in the CSS files.

The problem is that the CSS files are not 'refreshed' if they do not change, whatever happens with the variables it contains. So unless I empty the cache in the admin board or add changes to the stylesheet, the color will stay green.

Callguy said that the tag will
     a) process the stylesheets through smarty
     b) write the processed database stylesheets the tmp/cache directlry
     c) output tags to the cached files

I'm not sure what it means exactly, but I'm pretty sure that what I want to do is possible. It should be at least...

Where can I find info about how to use this {cms_stylesheet} ?

Cheers :)

Re: Different colors for different templates using the same CSS files

Posted: Mon Jul 19, 2010 5:56 pm
by Dr.CSS
If you have the same template duplicated you can give one a class on the body then in the style sheet call something which has a color you want to change like...

#content {background-color: green}

Then...

.bodyclass #content {background-color: red}

Re: Different colors for different templates using the same CSS files

Posted: Tue Jul 20, 2010 7:14 am
by Yvan B
That's a possibility, of course. But I think it makes a lot more sense to set in my first template something like:

{assign var="lien" value="RGB(40,100,0)"}

Set another value in the second template and then use it in the CSS this way:

a, a:link a:active {
text-decoration: none;
background-color: inherit;
color: [[$lien]];
}

It would be ideal: it's clean and make perfect sense. Now, how can I make the stylesheets be refreshed when the value of my $lien variable change ?

Re: How to use {cms_stylesheet} ?

Posted: Sun Jul 25, 2010 10:25 am
by Andiministrator
I got the same problem now. I want to use a different background image for each page and use in my stylesheet:

Code: Select all

background: #f7ee31 url([[$headerimage]]) no-repeat 308px 102px;
Is there a way, that CMSms doesn't cache the stylesheet?

Re: How to use {cms_stylesheet} ?

Posted: Mon Jul 26, 2010 12:45 am
by Dr.CSS
One of the main ideas behind the new cms_stylesheet tag is that it will cache them, so I don't think there is a non cache setting...

Re: How to use {cms_stylesheet} ?

Posted: Mon Jul 26, 2010 5:39 am
by Andiministrator
Ok, thanks for your answer. I thought, CMSms can render different stylesheet cache files (in case of changes at the css content) and compares just a checksum or something else.

Maybe that can be a feature in a future release.

Re: How to use {cms_stylesheet} ?

Posted: Mon Jul 26, 2010 3:45 pm
by Dr.CSS
It does check to see if the CSS has changed, you have to go to style sheets and actually make changes to it for this to kick in...

Re: How to use {cms_stylesheet} ?

Posted: Mon Jul 26, 2010 3:48 pm
by calguy1000
I got the same problem now. I want to use a different background image for each page and use in my stylesheet:
This is not what the cms_stylesheet tag is for.

If you want page specific styles, put the styles in your page or page template.

Re: How to use {cms_stylesheet} ?

Posted: Tue Jul 27, 2010 7:45 am
by Yvan B
In the end, I've defined the colors in UDTs, added them in the templates, added an id in the of my member's page template and created a special stylesheet to redefine the colored elements of the member's page.

I think it's the best I could do. (Solved for me) Cheers