I use a css sheet that’s actually .php so I can make cascading changes easily (style.php) e.g.
[php]a {color: <?php echo $AccentColor1 ?>;}[/php]
The colours are set in a separate file with an include command (colours.php). They’re typically directly assigned, e.g.
[php]$AccentColour2 = “#efefef”[/php]
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
[php]$AccentColour1 = “#a9100c”;[/php]
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
[php]$AccentColour1 = $Main_colour;[/php]
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
[php]$TempVar = #cdcd57;
$AccentColor1 = $TempVar;
$AccentColor1 = $Main_colour;[/php]
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?