[SOLVED] Share smarty variables between multiple CSS
Posted: Mon Jan 28, 2013 9:56 pm
Hello!
I am currently using multiple CSS for an adaptive website (media-queries-specific CSS and pre-IE 9 specific files) and manually loading them in my template with {cms_stylesheet name="mycss"}, depending on the context.
I've noticed that variables defined in smarty within a stylesheet have a local scope.
I.e. if I load stylesheet #1 and #2, and if I've defined
[[assign var='red' value='#900']] in #1
then [[$red]] isn't defined in stylesheet #2
- Is my assumption correct about the local scope?
- I could most probably intuitively bypass this by defining these variables as global smarty variables in my template, then access them in the CSS. Is there a way to avoid that? Maybe to include a CSS that simply defines smarty variables within another CSS?
Thank you for your help and ideas and have a great day.
Best regards,
JS
I am currently using multiple CSS for an adaptive website (media-queries-specific CSS and pre-IE 9 specific files) and manually loading them in my template with {cms_stylesheet name="mycss"}, depending on the context.
I've noticed that variables defined in smarty within a stylesheet have a local scope.
I.e. if I load stylesheet #1 and #2, and if I've defined
[[assign var='red' value='#900']] in #1
then [[$red]] isn't defined in stylesheet #2
- Is my assumption correct about the local scope?
- I could most probably intuitively bypass this by defining these variables as global smarty variables in my template, then access them in the CSS. Is there a way to avoid that? Maybe to include a CSS that simply defines smarty variables within another CSS?
Thank you for your help and ideas and have a great day.
Best regards,
JS