Advice
Permalink
I work for a design firm and they create websites where almost every page look differently. What is the best way to use C5 to edit things but keep everything different? Single pages? If so how would I go about doin that?
If you look at the attachment you will see the site i'm working on... you can also view it here...
http://crcc.turnpostadmin.com/
If you click on "about us" You will see the title "about us" and then the content... well I need the jpg in the back that has the title (about us) on it to change every page. Does this mean I'm going to need a new theme for every page?
http://crcc.turnpostadmin.com/
If you click on "about us" You will see the title "about us" and then the content... well I need the jpg in the back that has the title (about us) on it to change every page. Does this mean I'm going to need a new theme for every page?
You don't need a different single page or theme to do this. The best way is to simply add a Page Attribute (e.g. 'bkgd_image') and set that on each page to point to your background image. Then in your theme, for example in default.php, you'll have a div that uses that background image. There're several ways you could use the attribute but the simplest would be something like:
<div style="background: url(<?=$c->getAttribute('bkgd_image')?>)">
<div style="background: url(<?=$c->getAttribute('bkgd_image')?>)">
I've never done this before. Could you walk me through the steps? I've inserted the code that you gave to me and it just broke the page.
<div style="background: url(<?=$c->getAttribute('images/int_about.jpg')?>)">
<div style="background: url(<?=$c->getAttribute('images/int_about.jpg')?>)">
To add the new page attribute go to the 'Page Types' tab of 'Pages and Themes'. Scroll down to the bottom and click 'Add Page Attribute'. Give it a handle (e.g. 'bkgd_img') and select an appropriate type; if you go the route I mentioned earlier just use 'Text Box'. Give it a pretty name and click 'Add'.
That should do it.
That should do it.
'Pages and Themes' is in the Dashboard (you probably know that). Make sure the handle matches the argument to getAttribute (i.e. use 'bkgd_image' in BOTH places).
To add a specific page attribute value you need to edit each page individually, click on the "Properties" icon at the top of the page, go to the "Custom Fields" tab, select the pretty name for the attribute you created (e.g. "Background Image") from the Custom Fields dropdown box, then type in the specific value for the image at the bottom in the new text field that opened up (e.g. images/aboutus.jpg).
In the theme file (default.php) you will also need to tell C5 where your theme directory is so my example line should have been:
<div style="background: url(<?=$this->getThemePath().'/.$c->getAttribute('bkgd_image')?>)">
To add a specific page attribute value you need to edit each page individually, click on the "Properties" icon at the top of the page, go to the "Custom Fields" tab, select the pretty name for the attribute you created (e.g. "Background Image") from the Custom Fields dropdown box, then type in the specific value for the image at the bottom in the new text field that opened up (e.g. images/aboutus.jpg).
In the theme file (default.php) you will also need to tell C5 where your theme directory is so my example line should have been:
<div style="background: url(<?=$this->getThemePath().'/.$c->getAttribute('bkgd_image')?>)">
Here is what I did.
I set up a page attribute and then i have the follow in the handle
getAttribute('bkgd_image')?>)
then i set it to text and i typed in images/image.jpg and created it.
does my css need to be a certain way because of the code above?
I set up a page attribute and then i have the follow in the handle
getAttribute('bkgd_image')?>)
then i set it to text and i typed in images/image.jpg and created it.
does my css need to be a certain way because of the code above?
Whenever I add the following code to my default.php I get a error
<div style="background: url(<?=$this->getThemePath().'/.$c->getAttribute('bkgd_image')?>)">
<div style="background: url(<?=$this->getThemePath().'/.$c->getAttribute('bkgd_image')?>)">
If the code you specified is exactly what you entered for your page, then there is a missing quote:
should be:
Notice that you don't have the ending ' after the /
Also, though not always necessary, I also put the ; at the end of the statement.
hth,
dave
should be:
url(<?=$this->getThemePath().'/'.$c->getAttribute('bkgd_image');?>)
Notice that you don't have the ending ' after the /
Also, though not always necessary, I also put the ; at the end of the statement.
hth,
dave
I would stick with the text type. Making the attribute an image isn't really what you want (or if it is I don't know how to tell you how to use it ;-)). Just put all the background images in your theme in the images directory (or whereever), then include that relative path in the page attribute (e.g. themes/mytheme/images/bkgd.jpg => images/bkgd.jpg in the attribute). The getThemePath function will tell C5 what the rest of the path is.
If you follow the these instructions (assuming they're right ;-)) you shouldn't need to do anything special in your CSS.
If you follow the these instructions (assuming they're right ;-)) you shouldn't need to do anything special in your CSS.
page and themes->page types-> edit attribute->
handle = getAttribute('int_about.jpg')?>
type = Text Box
Name = Background Image
return to site->edit mode->properties-> Background Image (text box) = themes/CRCC_Interior/images/int_about.jpg
I took out that code that i added to the default.php because it wasn't letting me see the page because of the php error.
and i promise the image is in the directory
handle = getAttribute('int_about.jpg')?>
type = Text Box
Name = Background Image
return to site->edit mode->properties-> Background Image (text box) = themes/CRCC_Interior/images/int_about.jpg
I took out that code that i added to the default.php because it wasn't letting me see the page because of the php error.
and i promise the image is in the directory
Note my message above too.
we are getting somewhere! I'm getting a url that is coming through! thanks for stinking with me and helping out it really means a lot!
The handle in the first part should just be 'bkgd_image' or something like that (a simple string).
In site->edit mode->properties->Background Image just put images/int_about.jpg
In default.php put:
getThemePath returns the location of your them (<c5dir>/themes/CRCC_Interior). getAttribute returns the value of the page attribute (images/int_about.jpg). That should work. The rest of it is just plain HTML/CSS and whether or not that part works is up to your particular theme.
In site->edit mode->properties->Background Image just put images/int_about.jpg
In default.php put:
<div style="background: url(<?=$this->getThemePath().'/'.$c->getAttribute('bkgd_image');?>)">
getThemePath returns the location of your them (<c5dir>/themes/CRCC_Interior). getAttribute returns the value of the page attribute (images/int_about.jpg). That should work. The rest of it is just plain HTML/CSS and whether or not that part works is up to your particular theme.
<div style="background: url(<?=$this->getThemePath().'/'.$c->getAttribute('bkgd_image');?>)">
that line of code breaks my webpage... I'll keep it up there for a while so you can see it.
i have my images paths set correctly and I have the handle set right now I believe. because the image is coming through ... just repeating and not actually where I want it to go.
that line of code breaks my webpage... I'll keep it up there for a while so you can see it.
i have my images paths set correctly and I have the handle set right now I believe. because the image is coming through ... just repeating and not actually where I want it to go.
why are you guys using a string attribute?
Concrete5 allows you to create an image attribute which lets you select a picture instead of typing its name. That's much safer and easier to use, isn't it?
I even wrote a little tutorial that shows you how to use an image attribute within a page list -http://www.codeblog.ch/en/2009/03/concrete5-templates/...
Concrete5 allows you to create an image attribute which lets you select a picture instead of typing its name. That's much safer and easier to use, isn't it?
I even wrote a little tutorial that shows you how to use an image attribute within a page list -http://www.codeblog.ch/en/2009/03/concrete5-templates/...
We already tired that and every time I use the image attribute my content disappears.
Image attributes are definitely working.
Did you check my tutorial?
I guess you had a php error in your code which causes php to abort the process..
Did you check my tutorial?
I guess you had a php error in your code which causes php to abort the process..
I'm very happy! I got it to work out! thanks so much everyone for your support!
I don't know how much "difference" you are talking about...
But you can choose theme for each page, so you may need to make custom theme or if the change is minimum... and then, page-types, would be the nect solution...
On the other hand, depends on how much flexibility you need....
But also... making "home" and "news" page running on c5 and the rest of the pages to be static HTML is also one solutions.