need help getting started parsing css data
Posted: Wed Sep 18, 2002 10:02 am
I just finished coding a PHP based helpdesk app, and I find out one of the users is color blind. I figure, no prob, I'll just give him a way to set his own preferences. Of course, I'm using CSS.
Giving the user a form with choices and writing it all out to a css file is no problem, but what I want to do is first read in an existing css doc, which is formatted like this:
BODY {
border: 2;
background: #dddddd;
font: verdana, Arial, Helvetica;
font-size: 8pt;
color: black;
}
A:LINK {
font-family: verdana, Arial, Helvetica;
font-size: 8pt;
color: darkblue;
text-decoration: none;
}
...
By reading it in, the user never has to completely start over.
Is the best way to handle this with arrays, evaluating each element as the page is rendered? For instance:
$style["body"]["border"] = "2";
$style["body"]["background"] = "#dddddd";
...
or is there a more elegant, more sensible way of doing this?
Giving the user a form with choices and writing it all out to a css file is no problem, but what I want to do is first read in an existing css doc, which is formatted like this:
BODY {
border: 2;
background: #dddddd;
font: verdana, Arial, Helvetica;
font-size: 8pt;
color: black;
}
A:LINK {
font-family: verdana, Arial, Helvetica;
font-size: 8pt;
color: darkblue;
text-decoration: none;
}
...
By reading it in, the user never has to completely start over.
Is the best way to handle this with arrays, evaluating each element as the page is rendered? For instance:
$style["body"]["border"] = "2";
$style["body"]["background"] = "#dddddd";
...
or is there a more elegant, more sensible way of doing this?