i have a stylesheet link like so
<link href="css/<? echo $theme;?>/styles.css" rel="stylesheet" type="text/css" />
Inside the CSS I want to be able to echo a background image outputted by the db
body{ background-image:url(../../images/<?php echo $theme.'/'.$background;?>);}
I tried adding the following to the beginning of my page but it just output everything in html code
<? header ("Content-type: text/css");?>
Im sure there is a bit to this, can anyone advise the best course of action?
Thanks in advance
Change the file ending to php so it gets run by the server, and once you’ve done that you can link to it as if it was a regular css file and make sure the header is correct set with that header code you have at the top of the file
Change:
To:
and top of that file you have
And btw since you seem to have php shorttags already enabled you might aswell use instead of using
Use