CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 23rd, 2002, 10:51 AM
squirrelc3 squirrelc3 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: Salem, NH
Posts: 10 squirrelc3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to squirrelc3
pass variables to css?

im using php and mysql. i have a standard css and wish to manipulate the css on the fly based on variables that i will populate via the database then pass to the css ... how can i get my php variables passed to the css?

Reply With Quote
  #2  
Old March 23rd, 2002, 09:26 PM
christo's Avatar
christo christo is offline
Introspective
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Nov 2001
Location: London, UK
Posts: 3,317 christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 5 h 42 m 28 sec
Reputation Power: 109
Send a message via ICQ to christo Send a message via Yahoo to christo
You could use PHP's file maniupulation functions to open and read the contents of your .css, and then use regexps to parse those contents, making any alterations you want - and then rebuild the file. BUT don't forget that this will affect all users who are viewing pages which <link> this .css file in... maybe that's your intention. I don't know.

Probably the fastest method would be to use some client-side DHTML, so if you have an input box, say, with an id of "myInput", you could send up a javascript array of variables produced by your PHP, and then adjust it's style properties like this:

document.getElementById("myInput").style.selector =value

where selector might be 'color'
value could be "blue"

If you do it this way, other people looking at the pages will still get the original style definitions until they run a db query and a new one is set.

Not sure if that's any help,
Hope so

Christo
__________________
This is me: http://chris.uk.com

Reply With Quote
  #3  
Old March 24th, 2002, 06:01 AM
Utopia's Avatar
Utopia Utopia is offline
superficial
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Peterborough, England
Posts: 188 Utopia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 36 m 8 sec
Reputation Power: 12
There is a script which does this in JavaScript, its not php but it does allow you to switch stylesheets on the fly.

You may/may not find it of use, but I thought it was worth mentioning.

http://www.alistapart.com/stories/alternate/

matt
__________________
_______________
Matt

Reply With Quote
  #4  
Old March 24th, 2002, 10:16 AM
squirrelc3 squirrelc3 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Location: Salem, NH
Posts: 10 squirrelc3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to squirrelc3
Talking found a solution

thanks matt and cristo for your assistance. (i actually was on matt's site yesterday in my search for the solution). we are using a single architecture for multiple sites and all content etc is fed via the db. we want to have variation in styles for each individual site(and not have to maintain the .css for each), and therefore we setup a table that holds all the .css criteria and provide a backend management tool for the customer to be able to chage/modify it.
What i came up with was to query the database upon entry to the site, gather all style criteria, then write the custom .css file on the fly, save to server, and you are set (all in php and mysql).

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > pass variables to css?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap