11-12-2008, 01:31 AM
I am working on a project in which users will be able to sign up for a program, lets compare it to a myspace page... and they can customize the look and feel of that page to a very limited extent.
What is the best way to have them choose colors of the page through CSS, have those changes be there always applied to their page and their page alone?
I don't need help with the implementation, I currently have it to where users can choose from pre-built stylesheets and those are used, but how do you set it up to where what options they choose in the setup wizard are then creating a new stylesheet just for that user on the fly?
Thanks a ton,
11-12-2008, 09:00 PM
I'm sorry, is my question confusing or does nobody really have much of a solution? There must be a way to do it, however the sites like myspace and such would do it to keep that 'custom' look for each user's page... is that a separate css sheet for each user?
I know the other method would be to dynamically do the CSS inline, which would be pretty easy then just reference the database of what the user chose as their colors etc., but I'm wanting to keep all the CSS in external sheets... is that just not possible?
11-12-2008, 09:20 PM
In theory you could have a form field which the user inputs their CSS which is saved server-side into a database, give each user a unique ID and call a stylesheet which pulls up the CSS from the database. What's wrong with this?
11-12-2008, 09:39 PM
I get the saving it server-side in a database, we're already doing that with all kinds of other info... and the user has a unique ID already, I don't understand clearly how to 'call a stylesheet which pulls up the CSS from the database' ?
I know how to do the CSS inline with code pulling the data from the database, but I don't know how to do it in an external stylesheet, is that doable?
11-12-2008, 09:55 PM
When you initially put the CSS into the database, one of your columns would be the unique ID of the user and the other the CSS.
You'd call it like this
<link rel="stylesheet" type="text/css" href="/styles/user.php?userid=12345"/>
Or something similar.
You would then output a text/css header like this:
Then you would ask the database for the CSS which you put in there earlier by selecting it using the user ID.
The concept make sense?