| Using PHP for CSS stylesheets: | | | | To use the variables, simply define them and declare |
| Using PHP to create CSS stylesheets has many | | | | a php script with the variable in it. Using variables to |
| useful applications: | | | | mark up your CSS files, instead of simply stating |
| 1. The ability to dynamically create styles | | | | everything over and over again, cuts down on much |
| 2. The ability to change multiple values of a style or | | | | of the work involved in web design (imagine not |
| multiple style-rules at a time | | | | having to write colors such as #01C791, or using the |
| 3. The ability to use databases | | | | -moz-border-radius several times over. Pretty great, |
| 4. The ability to access server-side information | | | | huh?). It also allows the ability to grab server side |
| 5. The ability to generally use less coding on your part | | | | information, and it potentially can act as a bridge |
| So how is this done, eh? Actually, it's quite simple. | | | | between JavaScript and CSS. |
| Just add the following code to the top of your CSS | | | | Now what can this be used for? Lots of things. |
| file, within php tags:header("Content-type: text/css"); | | | | Suppose you wanted to manipulate the color of your |
| Now rename your stylesheet, changing the ending | | | | text to match the W3C standards of readability. Or |
| from ".css" to ".php". On the call to the stylesheet | | | | you want to allow visitors to set their own colors, |
| from your webpage, make the same name changes. | | | | widths, etc and save them to a database for future |
| Whew - now you're done. | | | | use. The applications are many and various - explore. |