CSS Constants - Moving server side
(Page 4 of 7 )
There are basically two ways to simulate CSS constants on the server. One involves using the server software and the other involves using scripting languages on the server.
Using Server Side Includes (SSI)
Server Software, like Apache and the Microsoft IIS allow for server side includes (SSI). We can use these to simulate CSS constants.
For Apache, we define a new file extension called “sccs” for “Server Cascading Stylesheets” by adding the following to the configuration file of the server:
Options +Includes
AddType text/css .scss
AddHandler server-parsed .scss
Inside one of these new “scss” files we can use the Server Side Includes syntax to set and retrieve our constants:
<!--#set var="blue" value="#369" -->
<!--#set var="green" value="#363" -->
ul#navigation{ background:
<!--#echo var="blue" -->;
color:#fff;
}
h1{ border-bottom:1px solid
<!--#echo var="green" -->;
}
Many Web space providers won’t allow users to change the server configuration, though. What most provide are Server Side Scripting Languages, that can also be used to simulate CSS constants.
Next: Using Server Side Scripting Languages >>
More Style Sheets Articles
More By Chris Heilmann