Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
How to save CSS?StyleSheet in Database ?
Old 07-22-2009, 09:02 AM How to save CSS?StyleSheet in Database ?
Junior Talker

Posts: 3
Name: Farhan Bajwa
Trades: 0
Hi,

Is there any way to store CSS settings and classes into a database. I have a css file describing styles for whole website.
I want to give user an option, to modify styles (background color, font, table header font, etc.) of thier own choices (at run-time). When user selects from the given options and hit save, then these values store in the database, so that when user visits the website next time then customized styles (theme) should be displayed on the web pages rather than default styles.
I know this can be done by using cookies (through javascript) but the problem arises when user visits the website after deleting private data of browser. In this way, again default styles applies to all web pages.
Also, i am using Java language(Wicket framework).

Is there any way to make css file dynamic (using variables in css file), or to save css classes (styles) into database ?

Thanks,
Farhan.
FarhanBajwa is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-22-2009, 10:21 AM Re: How to save CSS?StyleSheet in Database ?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Yep, Save the user options as text in a database and write a user stylesheet into the page.
This allows the global style sheet to remain unchanged, but onpage user defined rules will override the global rules.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-22-2009, 10:38 AM Re: How to save CSS?StyleSheet in Database ?
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Also, you can send a "Content-Type: text/css" header for a file with any extension, if you want to load the page externally, from a <link> tag etc. Then, you could treat the file just as if it were any other dynamic page, only you would only be serving CSS. Don't know anything about Wicket, but I can't imagine it will be that hard to do.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-22-2009, 10:52 AM Re: How to save CSS?StyleSheet in Database ?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Wicket
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-23-2009, 03:18 AM Re: How to save CSS?StyleSheet in Database ?
Junior Talker

Posts: 3
Name: Farhan Bajwa
Trades: 0
The above mentioned suggestion didnt work for me, so just forget database, the other option is to make CSS dynamic. Is there any way to make CSS file dynamic using java ?
For example: CSS styles are implemented in a separate file(styles.css) like: body{background:{$color};} and then modify that color variable in javacode to make styles dynamic.
FarhanBajwa is offline
Reply With Quote
View Public Profile
 
Old 07-23-2009, 09:23 AM Re: How to save CSS?StyleSheet in Database ?
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Dynamic is a very loose word, and you're not really asking anything different than you were before. If you have implemented the above suggestions, I suggest you adapt them to what you need. I know they work because I have used both techniques.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to How to save CSS?StyleSheet in Database ?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34039 seconds with 12 queries