Using an Attribute to change page elements

Permalink
Hi

I'd like to be able to change the colour for a section of a page per service using a page attribute.

I've managed to peice this code together using what I found on the Forum and have it working as I need but I feel the way I've coded it could be better. Can someone be kind enough to tell me how to clean this up in an Array or something?

Code used below

Thanks Matt


<?php 
if(isset($_POST['rbRepeat']))
{$c->setAttribute('pageBackgroundRepeat',$_POST['rbRepeat']);}
$pageColour = $c->getAttribute('pageColour');
if(isset($pageColour) && $pageColour != '')
{echo '<style type="text/css">.healthCheckRow {background: ' . $pageColour . ' !important; }</style>';    }
if(isset($_POST['rbRepeat']))
{$c->setAttribute('pageBackgroundRepeat',$_POST['rbRepeat']);}
$pageColourWeb = $c->getAttribute('pageColourWeb');
if(isset($pageColourWeb) && $pageColourWeb != '')
{echo '<style type="text/css">.healthCheckRow {background: ' . $pageColourWeb . ' !important; }</style>';    }
if(isset($_POST['rbRepeat']))
{$c->setAttribute('pageBackgroundRepeat',$_POST['rbRepeat']);}
$pageColour = $c->getAttribute('pageColour');
if(isset($pageColour) && $pageColour != '')

Matteld80
 
shahroq replied on at Permalink Reply
shahroq
Check this topic, also there is a Color Picker attribute attached to post that ease selecting color from a palette.
http://www.concrete5.org/community/forums/customizing_c5/color-pick...