Hi folks,
I have a website where user can select themes, customize background,text and many more. I want to save all the changes.
Which one would be a better read?? a database read or a file read.
any suggestions?
Thanks in advance !!!
Hi folks,
I have a website where user can select themes, customize background,text and many more. I want to save all the changes.
Which one would be a better read?? a database read or a file read.
any suggestions?
Thanks in advance !!!
By far a database will give you the best possible control, security and flexibility for the content your users will be customizing, in this case being CSS. You are far better off putting together the programming back-end for a database layout from the get-go, for I can't really see any positives in going with a flat-file based customization system. As for reading, once again the database will give you the best speed and reliability performance hands-down.
If you had a limited number of fixed themes, files would undoubtedly be better since the files could be cached and the web server is very fast at serving static content (plus you could use a CDN to further improve loading times for the users).
However, since you indicate that you want each user to be able to customize and persist its own detailed settings, I'd say that storing the styles in a database would be the best choice. The number of possible combinations of styles would probably result in a great number of CSS files, and reading/writing changes could get error-prone and tedious.
Well, it depends largely on how engaged your users are in the site. If they are not registered users of some kind (with a login), there's really no idea in using a database - they could just be random people who takes space. For that, I would use long term cookies.
Thus, it's unlikely that it's a good idea to have the customization options too complex - being able to change specific CSS rules would be downright stupid regarding most users, if not all users. Not said, that you can choose for them to be able to change a variety of settings at once, like, changing the shape of boxes.
These kinds of settings could be rewrote into very small pieces of data, and used with both cookies and databases.
A file read could be considered, but then for some kind of read-once-and-store-in-session-variables, say, from an XML file with general user data. But then again, that's the same as using a database.
I would place the themes into their own separate folders, these will not change and if you have a 100 users using the same theme there is little point having 100 database records with identical content in them. Also loading from a file will be quicker than loading from a database.
User settings would be stored in a database. When a user page is viewed their profile would be generated and cached.
This seems to me to be a very economical way of running things.