Background image page attribute

Permalink 2 users found helpful
Ok have been reading.. but still stuck..

Created page attribute called bkgd_image, and now on each page I can go to Custom attributes, file manager and select the image that should be used as the background image..

but how to call that attribute in the template? and it is default.php i should be adding the code to right?

i think i've just read too much and now over complicating the matter... any help appreciated!

adec

adec
 
olliephillips replied on at Permalink Reply
olliephillips
adec replied on at Permalink Reply
adec
scrap that deleting post because it wasn't actually working :) more reading..
adec replied on at Permalink Reply
adec
ahh! now I get it!

<div id="container" style="background: url(<?php echo($c->getAttribute('bkgd_image')->getVersion()->getRelativePath());?>)">
Vinylburn replied on at Permalink Reply
Vinylburn
How did you create the page attribute? Can you elaborate on this?
TheRealSean replied on at Permalink Reply
TheRealSean
In the pages and themes window there is a tab in called Attributes
index.php/dashboard/pages/attributes/

If you go there and choose an attribute type in this case an image and then give it a name and handle.

Then on the page you can add it to the custom attribute tab and assign an image.

Then its the code above to add that image into the code
Vinylburn replied on at Permalink Reply
Vinylburn
I see now, so in this case the "bkgd_image" is the handle that is entered into the custom attribute and the name is what ever you want it to be. I notice in the yogurt theme that this will only work on the header.php page. This may sound amateurish but is this the page where I enter all my code for styling and formatting the entire site?
jordanlev replied on at Permalink Reply
jordanlev
There are a variety of different files you would edit to style and format your site. header.php is probably where a containing wrapper div would be located, but there are other "page type" templates in a theme -- left_sidebar.php, right_sidebar.php, full.php -- that usually take what's in header.php and combine it with some html for the middle part of the page and then combine in the footer.php file for the bottom of the page (this way if you change the header, it applies to all the different page layouts instead of having to edit three separate files for a header change).
TheRealSean replied on at Permalink Reply
TheRealSean
I sometimes create two separate headers one for my home and one for the rest of the site.

When the two are extremely different, but generally I only use the one.
and define my site wide settings here, and as Jordan has said, I then use extra files to adjust themes on specific pages. (Generally when dealing with custom templates for a block)
harveyappleton replied on at Permalink Reply
harveyappleton
Developed a simple addon to do this for you across whole site, and free! :) -http://www.concrete5.org/marketplace/addons/background-image/...