There Must be a way – Colours vary throughout site...

Permalink
Hi, just need to say at the start that C5 is Awesome

Ok, forgive my ignorance, and my complete lack of PHP knowledge, but there must be a simple way of doing this:

I have a load of pages with the same layout (therefore the same Page Type), but the only thing that changes is the highlight colour for each page – 5 in total.

Now in the old days of hard coding every page I used to have a unique class on the body tag of each different (coloured) page. I would then adjust styles according to which class is called, thus adjusting the colour.

Now, Instead of creating 5 different page types each with a unique class hardcoded into the body tag is there a way to say:
"This is the About page, therefore apply the "about" class to the body"

Sorry if this is a simple question to answer but I have no knowledge of PHP

Thank you, and did I mention C5 is Awesome

dancer
 
jelthure replied on at Permalink Reply
jelthure
simple, just open up your template which contains the body tag in and update it like this:

<body id="<?php echo $c->getCollectionHandle(); ?>">


What this will do is give you an unique id for what ever page is being viewed. so like if your page is called "Contact Us", then this code will put "contact-us" into the id of the body tag.

Hope this helps!
dancer replied on at Permalink Reply
dancer
A-M-A-Z-I-N-G!!!!

Thanks. I assume there is a list of unique (to C5) PHP functions that is in the documentation somewhere.

Thank you sooo much though
dancer replied on at Permalink Reply
dancer
In response to my post above, I just found this:
http://www.concrete5.org/index.php?cID=7255...
Cyberdave replied on at Permalink Reply
Cyberdave
Does this still work?