This is a discussion on "Dynamic CSS problem" within the Web Page Design section. This forum, and the thread "Dynamic CSS problem are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Dynamic CSS problem
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Dynamic CSS problem
I have a site by where i want to pass a different variable into a css file depending upon the page.
Currently i am using:- <? $pgcolor="#000000"; ?> <link href="style.php?pgcolor=<? echo $pgcolor;?>" type="text/css" rel="stylesheet"> and then within the css file style.php am using:- <?php header("Content-type: text/css"); $pgcol= $_GET['pgcolor']; ?> body { color:<?=$pgcol?>; } <? ?> This isnt working for me.. Is there a way of doing it? Thanks |
|
|
|
#2
|
|||
|
|||
|
Re: Dynamic CSS problem
From what I know $_GET and $_POST require a form with one of the two methods. I have never done this myself but I do know some have used PHP style switchers etc to do stuff like this. I will see if I can find something. Iwould think it would be easier to store the info in a database and just pull it as required, but maybe not heh. My PHP knowledge is a working knowledge of it and not really a coder level.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#3
|
|||
|
|||
|
Re: Dynamic CSS problem
This looks a very convoluted way of doing things.
How much css do you want to be page specific? Are you only talking about the page colour? |
|
#4
|
||||
|
||||
|
Re: Dynamic CSS problem
You can easily pass a GET variable without a form if you need to. It probably won't validate though, and I don't know if you could do it in XHTML or not.
It seems like you should be able to pass a POST variable too, but I can't think of a reason to do it. But both of these are assuming you are actually going to display the page. On the other hand, I don't really see how you could pass a variable to a css sheet (or any undisplayed page) and I don't really see why you'd need to. It would be so easy just to put the info on separate little style sheets and switch the link. |
![]() |
| Tags |
| _get, css, file, within |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dynamic vs Static | Markb | Website Planning | 4 | Jul 27th, 2007 17:10 |
| Dynamic URL in a swf file | stupid dog | Flash & Multimedia Forum | 8 | Jul 26th, 2007 15:28 |
| Dynamic webpages | Schillaci | Starting Out | 1 | Jul 10th, 2007 10:18 |
| Creating a Dynamic Div with JS | jwalker80 | JavaScript Forum | 1 | Feb 13th, 2007 18:59 |
| Dynamic Menu (Please Help me) | bijeeshmk | Flash & Multimedia Forum | 5 | Jan 6th, 2007 10:38 |