...

View Full Version : how to apply themes



eshban
09-12-2005, 08:26 AM
hi,

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.

bfsog
09-12-2005, 09: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.



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


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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum