I have written code in xhtml for a site the links to my CMS system and I want to automatically colour code each section of the site.
I am using template pages, where the same template serves each section I would like to link the css to a variable in the php code so that it defines the colour of various elements of the page in the css.
I am trying to avoid having to create 8 versions of the css, one for each section, as making changes in the future would be a pain
So - for example I can define SECTIONcolour=1 in the php and I want the css to treat this as a variable and display color: #808080;
See the following link
http://clientwebsites.co.uk/absolute/
I'm sure its simple for one of you talented coders!
Any help would be much appreciated.
Thanks
MCR
PHP newbie needs help with PHP/CSS to colour code sections
Moderator: General Moderators
Re: PHP newbie needs help with PHP/CSS to colour code sections
have done this myself you would have to have your css in a php page with the following as a header:
then its simply a php file so as i know you would have gathered but like the following:
hope that helps
Code: Select all
header("Content-type: text/css");then its simply a php file so as i know you would have gathered but like the following:
Code: Select all
$current = intval($_GET['id']);
$current == 1 ? " color: green;" : "color: blue;";