View Full Version : how to apply themes

09-12-2005, 09:26 AM

i want to implement themes in my project. means i have different themes in a themes folder. The admin has rights to change and apply a new theme. i want that there is a list which shows all themes. when admin apply theme 1, then the header, footer and css of the complete site is change according to theme 1 .

how can i implement this. what is the logic behind this.

09-12-2005, 10:09 AM
Well, I personally would have 2 (or more) .css files, each having defined a styling for each of your elements. The class name would be the same in all 2 files.

You could store the name of the chosen theme in a file, and when you write your <link> tag, you could use PHP.

$cssFile = "themes.txt";
$fh = fopen($cssFile, 'r');
$theData = fread($fh, filesize($cssFile));
echo "<link rel=\"stylesheet\" type="text/css" href=\"$theData\" />

Then all you would have to do is write a function that takes in the name of the file (such as theme3.css, nighttheme.css) and overwrite themes.txt with this.