更改主题/ CSS根据用户 [英] Change Theme / CSS based on user

查看:93
本文介绍了更改主题/ CSS根据用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个产品,我们最终将白标。现在,我试图找出以编程方式促进这些要求,使用户可以通过他们的个人资料/设置表单更新网站的基本设计(即标题颜色等)的最佳方法。

I am building a product that we are eventually going to white-label. Right now I am trying to figure out the best way to facilitate these requirements programmatically so the user can update the basic design of the site (ie header color, etc) via their profile/settings form.

要求:
- 用户可以更新的标志(这是完整的)
- 用户可以更新的基本设计要素(基于CSS),即标​​题颜色,页脚颜色,侧边栏的颜色 - 所有的基本CSS重写

Requirements: - User can update the logo (this is complete) - User can update basic design elements (based on CSS), ie header color, footer color, sidebar color - all basic CSS overrides

我们不希望使用ASP.Net主题/皮肤,因为需要在本地文件系统中存储​​静态主题。我们希望在数据库中使用CSS来覆盖基本风格和存储这一点。

We don't want to use ASP.Net Themes/Skins because that requires storing static themes in the local file system. We would like to use CSS to override the base style and store this in the database.

我们的初步计划是把CSS存储在一个简单的VARCHAR字段在数据库中,并使用编写CSS到母版页上pre-Init事件!覆盖的基本样式。这是最好的解决方案?如果没有,你做了什么来实现这个功能/

Our initial plan is to store the CSS in a simple varchar field in the database and write that CSS out to the Master Page on Pre-Init event using "!" to override the base styles. Is this the best solution? If not, what have you done to accomplish this functionality/

推荐答案

我已经有几个月前。而使用由专用的处理程序产生的动态的CSS / servlet的一直第一溶液,以提高性能的定制CSS被现在产生在文件overrinding标准的CSS的基本要素:

I've been there some months ago. While using dynamic CSS generated by a dedicated handler / servlet has been the first solution, to improve performances a customized CSS is now produced on file overrinding the basic elements of the standard CSS:

<link rel="stylesheet" href="standard.css" />
<link rel="stylesheet" href="<%= customer_code %>/custom_style.css" />
...
<img scr="<%= customer_code %>/logo.png" />

每个自定义CSS将拥有自己的网址,这样可以使浏览器缓存他们。

Each custom CSS will have its own URL, so you can make the browser caching them.

这会让你节省的为每个请求的用户将:

This will make you saving for each request the users will make:


  1. 从数据库到应用层流量

  2. 从应用层流量的浏览器

  3. 部分计算在应用层

我将第二个想法用户应填写一份网上表格,详细说明他们想要做什么自定义。

I'll second the idea the user should have to fill out a web-form detailing what customizations they want to make.

这篇关于更改主题/ CSS根据用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆