Principles
The main principle of this solution is that all the involved components,
including the stylesheet, are PHP components that will be interpreted by the web
server before being offered to the user. All the involved components will
therefore be named with a
configuration one that will use a
file).
Illustrating this article requires the creation of three files:
including the stylesheet, are PHP components that will be interpreted by the web
server before being offered to the user. All the involved components will
therefore be named with a
.php
file extension but the visualconfiguration one that will use a
.inc
extension (include PHPfile).
Illustrating this article requires the creation of three files:
- The CSS stylesheet
stylesheet.css.php
file that is a normal
CSS stylesheet but including some PHP code. For that reason, and although the
.css
extension is kept, the file is named as a PHP file. For some
reason that I don’t know yet, this type of filename containing two dots can
cause some problems on some operating systems. If so, simply change the
filename fromstylesheet.css.php
to
stylesheetcss.php
. - The visual configuration
visuals.inc
file that will contain
the visual configuration parameters as an array of key-value pairs (similar to
the WINDOWS INI file way). This file is being included in the CSS stylesheet
in order to make the visual configuration parameters available to the
stylesheet. - The index
index.php
file that is our test file and will
mainly contain HTML code using the styles defined in the stylesheet.
To avoid any confusion, those three files are assumed to be stored in the
same directory. The location of this directory is not important as long as it is
located somewhere under the root of your web server. Let’s move on to the
definition of the
same directory. The location of this directory is not important as long as it is
located somewhere under the root of your web server. Let’s move on to the
definition of the
visuals.inc
file.