Custom attribute using CSS
Permalink
Hi - I have a template which using a similar layout structure throughout however the background colours/designs change via css in five different ways in the content area div and the footer.
I wanted to avoid making 5 different templates by making a custom attribute to two of the divs.
They are marked up like this
Is there a way of setting up a custom attribute to call in the different coloured divs to save having to make a new template each time?
Not sure which attribute type I should use or how to implement it?
Any ideas would I'd be really grateful for...
I wanted to avoid making 5 different templates by making a custom attribute to two of the divs.
They are marked up like this
<div id="content" class="blue-gradient"> <div class="blue-gradient-footer" id="lowerFooter">
Is there a way of setting up a custom attribute to call in the different coloured divs to save having to make a new template each time?
Not sure which attribute type I should use or how to implement it?
Any ideas would I'd be really grateful for...
Thanks for this John its not seeming to call it yet though I've set up the attribute color and given the values of red, green etc which relate to the class names. Its not pulling in the names though.
Any ideas am I doing something wrong here.
<div id="content"class="-gradient"
Any ideas am I doing something wrong here.
Is this in a page type file or a block view? And have you made a selection in the page properties?
Jon
Jon
I have edited my template .php file for the page type with this code. Yes I made a selection in the properties panel.
Should work then - put this in your page and let me know if it outputs anything...
<?php var_dump($c) ?>
It's coming up with a whole lot of errors when I do this. I am working on my local machine using MAMP. Could this be the reason?
Try adding this line before the one jbx suggests:
<?php global $c; ?>
Then, in your page, you can do this:
Would that work?
Jon