Hi everybody,
I'm new in this forum, I'm a PHP developer looking for good solutions for changing colors, fonts, styles of a site on the fly. The idea is, the user will be given options to customize his/her web site's font, color of various elements etc. and then the site will be built accordingly. The look and feel will vary based on the user.

Can anyone give me a good solution how this can be done in a very efficient way.

Sayaan

There are a lot of ways that you could do this. One way would be to use sessions to store some info.

You can use a form like this one...

<form id="theme" action="" method="post">
<p>
 <select name="Color">
  <option>please select a Color ...</option>
  <option value="green">Green</option>
  <option value="blue">Blue</option>
  <option value="orange">Orange</option>
  <option value="purple">Purple</option>
 </select>

 <select name="Font">
  <option>please select a Font ...</option>
  <option value="green">Green</option>
  <option value="blue">Blue</option>
  <option value="orange">Orange</option>
  <option value="purple">Purple</option>
 </select>
<input type="submit" value="Change Theme">
</p>
</form>

Then place the following lines at the top of each php page....

<?
 session_start();

if(isset($_POST['Font']))  {$_SESSION['Font']	= $_POST['Font'];}
if(isset($_POST['Color']))  {$_SESSION['Color']	= $_POST['Color'];}

?>

Then in your <head> section echo your css theme....

<? 
echo "<style type 'text/css'>";

echo "p {color: ".$_SESSION['Color']." font-size: ".$_SESSION['Font']."}"; ?>
echo "</style>";

You would have to echo the session color and font throughout your css file.
You could also have predefined styles and use a similar session result.

Please note: I haven't tested this, but I think it might work.

There are probably better ways of doing this, but hope it helps.

This question has already been answered. Start a new discussion instead.