Padding and repeat tags using attributes

Permalink
Is there any way at all to give the user the ability to change background images on their site and then adjust the padding, height, width, margin, padding etc.. (like they can now on the design page) for the whole site?

I think the one thing that is either missing or that I'm not familiar with is to give the user the ability to change the styling of not just one container but the styling for the whole website. (unless I'm just missing something which is entirely possible).

I'd just like to know that this is NOT possible before spending money to have someone build this for me.

Thanks..

getjoel
 
jelthure replied on at Permalink Reply
jelthure
this user you speak of, is it a registered user with edit permissions? if so then you can set up your theme css to be customizable. Take a look at one of the default themes that come with C5. in them you'll see special comments like this:

/* customize_background */ background-color: #000; /* customize_background */

or
/* customize_header_logo */ color:#777; /* customize_header_logo */


that sets up a style for customization from within the dashboard. simply add a few of those special comments in your theme.

then go to the themes page in the dashboard, and for the theme you are working with click on the customize button. This will give you control over your styles.

As far as i know this will only work with certain styles and you may have trouble if the style definition is a short cut.
getjoel replied on at Permalink Reply
getjoel
I've done all of that for colors.. but what about background images? Will it work for that?
jelthure replied on at Permalink Reply
jelthure
not currently. but you can set those up as page attributes. Create an attribute called say "page_background" then in your template add something like this:

<?php
  if($c->getAttribute('page_background')){
    $bgStyle = "background-image:url(".$c->getAttribute('page_background')->getURL().");";
  }
?>
</head>
<body style="<?=$bgStyle;?>">


there's a few ways other then this to do it but it is all the same principle.
getjoel replied on at Permalink Reply
getjoel
Yes.. I figured that out.. but there's no way for them to adjust height, width, repeat, padding, etc.. correct?
jelthure replied on at Permalink Reply
jelthure
sure just set up a couple other page attributes, like "page_background_repeat" and set it up as a select with the options for background-repeat. then alter the code above to write out the proper definitions.

or better yet would be to create a whole new attribute type which when selected supplies all the fields in one attribute.

http://www.concrete5.org/documentation/how-tos/developers/create-a-...
getjoel replied on at Permalink Reply
getjoel
That's awesome.. but how do I set up one attribute with multiple criterias? I just added an image/file attribute for the navigation background.. then I clicked on the add attribute button above it and added an attribute for repeat-x, repeat-y, and no-repeat.. But it set up two different attributes. I'm not seeing where I can set up one attribute with all of these settings?
jordanlev replied on at Permalink Reply
jordanlev
To do this, you would have to create your own attribute that contains multiple fields. See:
http://www.concrete5.org/documentation/developers/attributes/overvi...