I am creating a web application in ASP.NET MVC 3 and SQL Server 2008. We want to allow our clients to choose their own styles for branding purposes.
Ideally, we would like them to choose from size, font and color attributes for the main html tags (h1, p, anchor, etc).
We were thinking about a开发者_如何学编程 form where users could choose size, font and color from drop downs for each of the supported tags and save this to a database. When this form was saved, we would save the entire style string in a field and return that as CSS file on the page.
The downfall with this approach is that when a user comes back in to edit these settings later, we will have to do some serious regex to get the attribute values and show them in the form again.
Any ideas on how best to implement this?
Thanks in advance, Viper.
Perhaps a better approach would to be to store each of the fields individually (either set the table up to have a field for each property or do a massive key-value pair setup) so that getting the data back out for changing is far easier (as the combining for the css on the fly is far easier than deconstructing it for editing)
精彩评论