OZONE Asylum
Forums
CSS - DOM - XHTML - XML - XSL - XSLT
passing variables to external css?
This page's ID:
28816
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Here is what I am trying to do. I have pages that are loaded from a php include. I need to pass variables to an external style sheet as well. It can be a lot of variables depending on the page. I have right now in the [b]index.php[/b] page: [code] switch ($_GET['link']){ case 'page1': $page = "pages/page1.php"; $bodyClass="page1"; $bgColor = "#008000"; break; case 'page2': $page = "pages/page2.php"; $bodyClass="page2"; $bgColor = "#800000"; break; default : $page = "pages/main.php"; $bodyClass = "main"; $bgColor= "#8080FF"; } [/code] Then in the external css page I have this (which is actually a php page with a header defined for css: [code] <? header("Content-type: text/css"); ?> body { background:<?=$_GET['bgColor'];?>; } [/code] but obviously this isn't working. I was trying to call the pages and the changes by this : [code] <div> <a href="index.php?link=page1">Page 1</a><br /> <a href="index.php?link=page2">Page 1</a><br /> <a href="index.php?link=main">Main</a> </div> [/code] I also tried to pass the background variables through the URL but that didn't seem to work either. Like : [code] <a href="index.php?link=page1&bgColor=#800000">Page 1</a><br /> [/code] not only does that look ugly, it didn't work. So does anyone have a good suggestion on how to pass these variables from the external css to the index page? Thanks in advance! oh, and the $bodyClass sets the id of the body depending on what page they are on. This works but that would mean that I would have to duplicate the same style for all the different pages and just make some changes. Later, C:\ [small](Edited by [url=http://www.ozoneasylum.com/user/1079]CPrompt[/url] on 01-11-2007 22:22)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »