Report message:*
 

Can Smarty parse a CSS file?

Subject: Can Smarty parse a CSS file?
by nachenko on 2008/1/22 4:13:45

Well, that's it.

I have just finished a theme for a Drupal site where the colors change upon user selection on a Flash-made color wheel. I got it really cool.

But this made me wonder... Could I do this with Smarty?

If Smarty could parse CSS files, it could do those two cool things for theming:

1 - Change colors and other CSS variables upon user selection. Users could choose their own favourite color palette.

2 - Define variables for colors. This is a much needed feature on CSS, using variables and math expressions on colors, so you can define tints and shadows. So, when the customer says "I think that after two months of asking you to put everything in red, I prefer everything in green".

And when this customer ask for a differnt color, you just change a number, and everything, tints, glows, shadows... change automatically.


Anyway, theming Ronins on-the-works should read this article.

http://www.barelyfitz.com/projects/csscolor/


Could i Do this using PHP? Sure, but honestly, including PHP in a Smarty template sucks. And I like the readability of a Smarty tag over a PHP variable insertion.

This: <{$myColor}>

Is much better than this: <?=$mycolor ?>

The former one appears in Dreamweaver design window. The second one doesn't, it appears the the PHP icon, but this icon doesn't tell you what's inside this PHP piece of code, no matter it's just a line or the Holy Bible.