[Solved]How to use {cms_stylesheet} ?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Yvan B
Forum Members
Forum Members
Posts: 60
Joined: Thu Apr 08, 2010 3:27 pm

[Solved]How to use {cms_stylesheet} ?

Post 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 :)
Last edited by Yvan B on Tue Jul 27, 2010 7:45 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

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

Post 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}
Yvan B
Forum Members
Forum Members
Posts: 60
Joined: Thu Apr 08, 2010 3:27 pm

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

Post 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 ?
Andiministrator

Re: How to use {cms_stylesheet} ?

Post 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?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: How to use {cms_stylesheet} ?

Post 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...
Andiministrator

Re: How to use {cms_stylesheet} ?

Post 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.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: How to use {cms_stylesheet} ?

Post 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...
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: How to use {cms_stylesheet} ?

Post 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.
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.
Yvan B
Forum Members
Forum Members
Posts: 60
Joined: Thu Apr 08, 2010 3:27 pm

Re: How to use {cms_stylesheet} ?

Post 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
Post Reply

Return to “CMSMS Core”