Dynamic CSS problem

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.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Oct 31st, 2006, 11:08
New Member
Join Date: Oct 2006
Location: London
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 31st, 2006, 12:59
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 31st, 2006, 13:33
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Oct 31st, 2006, 23:22
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
_get, css, file, within

Thread Tools

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 On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 17:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42