943,571 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 431
  • PHP RSS
Nov 24th, 2008
0

User based look & feel customization of site

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sayaan is offline Offline
5 posts
since Nov 2008
Nov 24th, 2008
0

Re: User based look & feel customization of site

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...

PHP Syntax (Toggle Plain Text)
  1. <form id="theme" action="" method="post">
  2. <p>
  3. <select name="Color">
  4. <option>please select a Color ...</option>
  5. <option value="green">Green</option>
  6. <option value="blue">Blue</option>
  7. <option value="orange">Orange</option>
  8. <option value="purple">Purple</option>
  9. </select>
  10.  
  11. <select name="Font">
  12. <option>please select a Font ...</option>
  13. <option value="green">Green</option>
  14. <option value="blue">Blue</option>
  15. <option value="orange">Orange</option>
  16. <option value="purple">Purple</option>
  17. </select>
  18. <input type="submit" value="Change Theme">
  19. </p>
  20. </form>

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

PHP Syntax (Toggle Plain Text)
  1. <?
  2. session_start();
  3.  
  4. if(isset($_POST['Font'])) {$_SESSION['Font'] = $_POST['Font'];}
  5. if(isset($_POST['Color'])) {$_SESSION['Color'] = $_POST['Color'];}
  6.  
  7. ?>

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

PHP Syntax (Toggle Plain Text)
  1. <?
  2. echo "<style type 'text/css'>";
  3.  
  4. echo "p {color: ".$_SESSION['Color']." font-size: ".$_SESSION['Font']."}"; ?>
  5. 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.
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
PomonaGrange is offline Offline
67 posts
since Jun 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: File Upload Error
Next Thread in PHP Forum Timeline: Infinite loop problem need help plz





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC