Quote:
Originally Posted by jeddi
Then I link my style file:
Code:
<Head>
<link rel='stylesheet' type='text/css' href='a_style.php' >
|
You are correct with everything to that point.
The problem is that your code in the "a_style.php" doesn't define the PHP variables before using them. The adjustment I have made below shows you where you need the extra code to get the styles to work.
PHP Code:
<?php
header("Content-type: text/css; charset: UTF-8");
// set values here or place these in an include
$body_font = '';
$body_bk_col = '';
?>
* {
margin: 0;
padding: 0;
}
html{
height:100%;
font-family:<?php echo $body_font; ?>;
}
.main {
width:<?php echo $widthpx; ?>;
padding:0 50px 0 50px;
background-color:#<?php echo $body_bk_col; ?>;
}
.main_img {
width:<?php echo $widthpx; ?>;
padding:0 50px 0 50px;
}
Possibly the only change you need is to move the include for the file that manipulates the values form the DB to include into the styles from the PHP file generating the HTML into the PHP file generating the CSS.