Page 1 of 1

Stylesheet caching w/ smarty variables

Posted: Fri Jan 29, 2010 12:12 am
by Jeff
I just added a new plugin for stylesheet retrieval.

http://dev.cmsmadesimple.org/projects/smartstylesheet

It is a rework of the {stylesheet} which exports a static file for the page to use, it automatically updates when the stylesheet is updated.

I also added smarty processing with the delimiters of [[ and ]], so you can have [[assign var=color1 value='#c3c3ce']] at the top of the file and then use later with [[$color1]]

Just a reminder, when static stylesheets are created the background image location usually needs to be changed. An easy way I found to do it is have [[assign var=dir value='/mydir/']] (watch the '/') at the beginning of the file and then do a search/replace with 'url('/'url([[dir]]'

Re: Stylesheet caching w/ smarty variables

Posted: Mon Feb 01, 2010 1:04 pm
by Tolekro
Hi, I'm very insterested of using variables in stylesheets. Could you explain how to install and use this feature?

I have tried to do it  as following:
Uploaded file: function.smarty_stylesheet.php to /functions/ directory.
Replaced {stylesheet}-tag to {smarty_stylesheet} in page template.

After doing this I'm getting error: Fatal error: Call to undefined function cms_smarty() in /home/jannehav/public_html/plugins/function.smarty_stylesheet.php on line 71

Re: Stylesheet caching w/ smarty variables

Posted: Mon Feb 01, 2010 11:34 pm
by Jeff
Sorry about that I accidentally uploaded my 2.0 version. I have now update it with the 1.6.x version.

http://dev.cmsmadesimple.org/projects/smartstylesheet

Re: Stylesheet caching w/ smarty variables

Posted: Fri Feb 05, 2010 12:26 pm
by Tolekro
Thank you for your great release.

I also noticed that function name should be changed from smarty_cms_function_stylesheet to smarty_cms_function_smarty_stylesheet to avoid redeclare error.

Re: Stylesheet caching w/ smarty variables

Posted: Fri Feb 05, 2010 11:12 pm
by Jeff
Thanks, fixed it.

Re: Stylesheet caching w/ smarty variables

Posted: Fri Aug 20, 2010 9:55 am
by Manuzzi
ajprog wrote:
Just a reminder, when static stylesheets are created the background image location usually needs to be changed. An easy way I found to do it is have [[assign var=dir value='/mydir/']] (watch the '/') at the beginning of the file and then do a search/replace with 'url('/'url([[dir]]'
search/replace with 'url('/'url([[dir]]' should be: search/replace with 'url('/'url([[$dir]]'

Re: Stylesheet caching w/ smarty variables

Posted: Fri Aug 20, 2010 10:04 am
by Manuzzi
The creation and edit date of the css file is getting the value 1-1-1970 in the tmp directory. Is their a way to let it generate the current date and time?

Re: Stylesheet caching w/ smarty variables

Posted: Wed Aug 25, 2010 9:14 pm
by Dr.CSS
This type of style sheet is now integrated into CMS Made Simple, it is {cms_stylesheet} and is included in all new installs/upgrades...