开发者

How can I implement an Orkut-like user facility to change site colors and style?

I would like to implement a facility like Orkut offers where user is able to configure开发者_开发百科 the colors and style for the site, and the changed styles will be used for the user.

I would like the user to be able to enter the color combinations for the site background, top navigation, and left navigation.

Can some one please let me know what all technologies/techniques are involved into this? Any pointers will be helpful. Thanks.


The easiest way is to do something like this: (PHP)

<?php 
//Query database, find the user's colors and create the $bgColor, $leftColor and $topColor variables
?>
<style type="text/css">
<?php echo "body { background-color: $bgColor; }"; ?>
<?php echo "div.left { background-color: $leftColor; }"; ?>
<?php echo "div.top { background-color: $topColor; }"; ?>
</style>

You can make this work on any language.


Here’s a couple of questions asking how to do something similar in Ruby-on-Rails:

  • Rails Giving Each User Their Own Customizable Stylesheet
  • User selected CSS stylesheet in Rails

There might be some useful hints in there. (I’ve never implemented anything like this myself.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜