tylerhall.ws— Tyler Hall has come up with a clever way to streamline edits for CSS constants (same styles repeated in different ids and classes) using PHP.
Dec 8, 2005View in Crawl 4
Processing the CSS file with PHP to replace the variables with their values is beyond ignorant. It's about a good idea as writing a PHP script that loads another PHP script line-by-line instead of just having a single PHP file, you write a PHP file that loads another PHP file and calls eval() on it. Ever hear of AddType application/x-httpd-php .css ???? I guess not.
Well.. it works.. and if it doesn't why don't you just point out why? There are always many ways to solve programming problems and they all have pros and cons.
I can see having constants defined, because I'd like to lay out all of my collors at the top for use throughout my site. That would be far better than having to "process" them each time, though. In a way, declaring an a:link color is making it a constant for each occurance in the html code, so a no-constant purist should even want to avoid css altogether -- maybe a wooden stake through each css file he finds, or something like that. [Sorry, I couldn't help myself. :)]
Hello... Is this thing on...?Hey there Tyler Hall. Wtf???Have you no idea what the C in CSS stands for? I'm sure you do, but I'll help you out for a moment here. Cascading... As in, cascading... Your method is completely null and void of any usefulness not found within the rules and guidelines of plain old CSS, and is cumbersome at best.It gets tiring seeing a bunch of nooblings with "This IS really cool". Jackasses. Complete jackasses.
Greg-J: How are you saying a single #FF0000 should be Cascaded rather than respecified again and again? I understand you think we're jackasses, but you need to give me your better way.
saintwankerDec 9, 2005
old news.no digg.still interesting though
cpriorDec 9, 2005
These are not constants but variables.<a class="user" href="http://www.php.net/constants">http://www.php.net/constants</a>
cmw72Dec 9, 2005
Very interesting. I've done this in the past. At least now I'm aware of the security risk.
sheeshDec 9, 2005
Processing the CSS file with PHP to replace the variables with their values is beyond ignorant. It's about a good idea as writing a PHP script that loads another PHP script line-by-line instead of just having a single PHP file, you write a PHP file that loads another PHP file and calls eval() on it. Ever hear of AddType application/x-httpd-php .css ???? I guess not.
instabilDec 9, 2005
Well.. it works.. and if it doesn't why don't you just point out why? There are always many ways to solve programming problems and they all have pros and cons.
jimdDec 10, 2005
I can see having constants defined, because I'd like to lay out all of my collors at the top for use throughout my site. That would be far better than having to "process" them each time, though. In a way, declaring an a:link color is making it a constant for each occurance in the html code, so a no-constant purist should even want to avoid css altogether -- maybe a wooden stake through each css file he finds, or something like that. [Sorry, I couldn't help myself. :)]
guitarromanticDec 10, 2005
See, my issue here is the fact that changing say 5 references to #COLOR isn't actually that big a deal. If it ain't broke etc..
moietyDec 10, 2005
One would hope this would be a no-brainer for anyone who's done any PHP parsing on CSS files. Good tip for new comers, I suppose.
greg_jDec 10, 2005
Hello... Is this thing on...?Hey there Tyler Hall. Wtf???Have you no idea what the C in CSS stands for? I'm sure you do, but I'll help you out for a moment here. Cascading... As in, cascading... Your method is completely null and void of any usefulness not found within the rules and guidelines of plain old CSS, and is cumbersome at best.It gets tiring seeing a bunch of nooblings with "This IS really cool". Jackasses. Complete jackasses.
jimdDec 10, 2005
Greg-J: How are you saying a single #FF0000 should be Cascaded rather than respecified again and again? I understand you think we're jackasses, but you need to give me your better way.