SunQuest
           CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 September 10th, 2003, 07:27 PM
silvertiger's Avatar
silvertiger silvertiger is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Denver
Posts: 62 silvertiger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 32 m 12 sec
Reputation Power: 5
using PHP to define variables in a CSS

Greetings all.

I am currently creating a site that allows the user to choose a "theme" with thier personal settings. I have successfully been able to load all of the inline html graphics and items with php, but what I am trying to do now is perform the same functions with a stylesheet. I have a CSS page that i renamed .php and added

# styles.php
header("Content-Type: text/css");

to the top so that it still sees it as a css page ...

the only thing I can't figure out is how to make the page call the PHP page and use it as a CSS.

i have a database set up with all the variables, etc... just need to get this past piece working.

beow is the entire CSS page:

__________________________________________________

<?php
include("data.php");
mysql_select_db("courtad_NISP", $dbcnx2);
$themes = @mysql_query(" SELECT theme FROM Affiliate_Prefs Themes WHERE affiliate_id='".$_SESSION["Affiliate_ID"]."'");
$themerow = mysql_fetch_array($themes);
$styles = @mysql_query(" SELECT * FROM Themes WHERE theme_id='".$themerow[""]."' ");
$stylerow = mysql_fetch_array($styles);
# styles.php
header("Content-Type: text/css");
?>
.menuitem {
font-family: "Palatino Linotype";
line-height: 25px;
font-weight: bold;
background-image: url(<?PHP echo $stylerow["button"] ?>);
background-repeat: no-repeat;
background-position: center center;
font-size: 12px;

}
a:link {color: #<?PHP echo $stylerow["a_link"] ?>; text-decoration: none; }
a:active {color: #<?PHP echo $stylerow["a_active"] ?>; text-decoration: none; }
a:visited {color: #<?PHP echo $stylerow["a_visited"] ?>; text-decoration: none; }
a:hover {color: #<?PHP echo $stylerow["a_hover"] ?>; text-decoration: none; }
.THL {
background-image: url(<?PHP echo $stylerow["thl"] ?>);
background-repeat: no-repeat;
background-position: left top;
}
.THC {
background-color: #<?PHP echo $stylerow["thc"] ?>;
}
.THR {
background-image: url(<?PHP echo $stylerow["thr"] ?>);
background-repeat: no-repeat;
background-position: right top;
}
.TFL {
background-image: url(<?PHP echo $stylerow["tfl"] ?>);
background-repeat: no-repeat;
background-position: left top;
}
.TFC {
background-color: #<?PHP echo $stylerow["tfc"] ?>;
}
.TFR {
background-image: url(<?PHP echo $stylerow["tfr"] ?>);
background-repeat: no-repeat;
background-position: right top;
}
.TCL {
background-image: url(<?PHP echo $stylerow["tcl"] ?>);
background-repeat: repeat-y;
}
.TCR {
background-image: url(<?PHP echo $stylerow["tcr"] ?>);
background-repeat: repeat-y;
}
__________________
Thanks,

Silver Tiger

Reply With Quote
  #2  
Old September 10th, 2003, 07:40 PM
wannabe wannabe is offline
=) wannabe?
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 2002
Location: florida
Posts: 2,153 wannabe User rank is Lance Corporal (50 - 100 Reputation Level)wannabe User rank is Lance Corporal (50 - 100 Reputation Level)wannabe User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 21 h 58 m 25 sec
Reputation Power: 9
Send a message via AIM to wannabe Send a message via Yahoo to wannabe
maybe u should separate the php that processes css stuff from the css and use the php script to write to the css file.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > using PHP to define variables in a CSS


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway