Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

php says variable has value A, uses value B

$
0
0
I use a css sheet that's actually .php so I can make cascading changes easily (style.php) e.g. 
a {color: <?php echo $AccentColor1 ?>;}
 
The colours are set in a separate file with an include command (colours.php). They're typically directly assigned, e.g. 
$AccentColour2 = "#efefef"
 
One colour (and possibly more once I get this to work) is stored in a database and retrieved by $Main_colour. When I echo $Main_colour it shows the expected value, (in this case #a9100c).
 
Here's where the problem arises...
 
If I put 
$AccentColour1 = "#a9100c";
in colours.php, the css in style.php works and everything that is meant to be that colour IS that colour.
 
However, if I put
$AccentColour1 = $Main_colour;
in colours.php, even though the main_colour variable displays the expected value when echoed, the css breaks and everything that is meant to be that colour comes out link blue.
 
It gets even more strange. If I put 
$TempVar = #cdcd57;
$AccentColor1 = $TempVar;
$AccentColor1 = $Main_colour;
the css works but everything that's meant to be #a9100c comes out as #cdcd57 instead... EVEN THOUGH both $AccentColor1 and $Main_colour echo as #a9100c before and after the css is processed.
 
Why is the css refusing to accept $AccentColor1 = $Main_colour?

Viewing all articles
Browse latest Browse all 13200

Trending Articles