How to store settings by user - views searched


Sorry this is quite an open-ended question!

I am looking to enable users on my site to be able to modify html/css parameters for templates they use for their profiles - a bit like myspace (really, really sorry about using that as an example...).

• There is a library of "themes" that can be selected by the user • Some themes can be customised some can not • Themes do not necessarily have the same customisable parameters

I want to store the customised variables for each user, for each theme they choose to customise. What's the best format for this?

DB could have

user id | theme id | custom parameters

How could I store things like bg colour = #34ed55 bg image = bg.jpg font = comic sans color = 554323 css = h1{ font-size:1em; color:blue; } .customCss{ padding:10px; }

If the parameters are all of the same type (such as string values), you could have a separate parameters table for mapping key/value pairs that represent the user's theme properties.



The table could like like:

user_id  key      value
1        bgcolor  #000000
1        bgimage  bg.jpg
2        font     Arial

If themes share common keys, you might factor the parameter keys into another table and reference them here by ID instead of duplicating the key strings (such as "bgcolor").