PHPBuilder - PHP enabled stylesheets



RSS Twitter
Articles Html

PHP enabled stylesheets

by: Bertrand Potier
|
November 24, 2002

Introduction

CSS Stylesheets are a major improvement in the World Wide Web, allowing HTML to come back to its roots: a language to structure and publish content on the web, not to apply a visual formatting to that content. Unfortunately HTML and CSS have the same limitations: both are static languages!
From Perl scripts to PHP, a lot of technologies are today available to move HTML to the dynamic age but why not, going even further and do the same with CSS? That's what I did when developing eDContainer (a container for web sites and web applications), having the following objectives in mind:
  1. To provide an external, user-friendly, visual configuration file: the user doesn't have to edit the stylesheet, he may not be familiar with CSS and even if so, properly editing a stylesheet requires some experience.
  2. To not have to repeat general identical values like fonts and colors x times within the stylesheet: the value is defined once in the visual configuration file and inserted automatically by PHP in the different locations within the stylesheet.
  3. To provide a solution to the implementation of skins or themes (similar to Winamp or Windows XP principles): several different visual configurations can be defined and dynamically switching from one to the other is possible.
  4. To be able to change some style behaviors dynamically, depending on some configuration values.
If you're quite familiar with PHP and CSS, reading the above objectives will probably make you already think about some solutions to achieve them. That's the fun about coding, always different and sometimes better ways to obtain the same results! When writing this article, I'm not saying that what is described here is the only way to do it. It's a way and I hope I'll manage to keep you interested: Let's start!

1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Bertrand Potier

Comment:



Comment:

(Maximum characters: 1200). You have characters left.