Dynamically set CSS styles at run time?

View: New views
3 Messages — Rating Filter:   Alert me  

Dynamically set CSS styles at run time?

by Andy Mcshane :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all, I have a website that needs to have a simple colour scheme set dynamically when a user logs in. This really only applies to backgrounds and text. Each login has a background colour and text colour stored in a database. What I need to do is dynamically set these values in my stylesheet depending on the user who has logged in, I want to do this without having to have multiple style sheets, is this possible?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:41:1711
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/41
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:41
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.41
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Dynamically set CSS styles at run time?

by Tim Knight :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm sure after 3 months you've probably thought of this but why not just name your stylesheet .cfm to allow the ColdFusion server to process it.  Then do you query at the top of the sheet outputting the colors where they need to go (don't forget to set your defaults).  It may be better however to create a small stylesheet that you do this in and then just call it from your master CSS sheet.

> Hi all, I have a website that needs to have a simple colour scheme set
> dynamically when a user logs in. This really only applies to
> backgrounds and text. Each login has a background colour and text
> colour stored in a database. What I need to do is dynamically set
> these values in my stylesheet depending on the user who has logged in,
> I want to do this without having to have multiple style sheets, is
> this
possible?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:41:1824
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/41
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:41
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.41
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

RE: Dynamically set CSS styles at run time?

by Andy Mcshane :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for taking the time to reply, I appreciate it. I have actually
implemented almost the exact same thing that you have suggested, great minds
think alike! :-)

-----Original Message-----
From: Tim Knight [mailto:tim.knight@...]
Sent: 07 September 2005 23:11
To: CSS
Subject: Re: Dynamically set CSS styles at run time?

I'm sure after 3 months you've probably thought of this but why not just
name your stylesheet .cfm to allow the ColdFusion server to process it.
Then do you query at the top of the sheet outputting the colors where they
need to go (don't forget to set your defaults).  It may be better however to
create a small stylesheet that you do this in and then just call it from
your master CSS sheet.

> Hi all, I have a website that needs to have a simple colour scheme set
> dynamically when a user logs in. This really only applies to
> backgrounds and text. Each login has a background colour and text
> colour stored in a database. What I need to do is dynamically set
> these values in my stylesheet depending on the user who has logged in,
> I want to do this without having to have multiple style sheets, is
> this
possible?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase Contribute 3 from House of Fusion, a Macromedia Authorized Affiliate and support the CF community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=53

Message: http://www.houseoffusion.com/lists.cfm/link=i:41:1826
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/41
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:41
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.41
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
LightInTheBox - Buy quality products at wholesale price!