3212 Posts in 847 Topics by 809 members
| Go to End | Next > | |
| Author | Topic: | 4002 Views |
-
Re: Changing background on each page without tons of templates

22 January 2010 at 10:47am
We all had to start somewhere
....
If this is your Background:
$fields->addFieldToTab('Root.Content.Main', new ImageField('Background'));
You dont't need my Image field....
It should be there in the cms, if you've added this to Page.php
public function getCMSFields(){
$fields = parent::getCMSFields();
// add the upload control for the background image to the cms
$fields->addFieldToTab('Root.Content.Main', new ImageField('Background'));
return $fields;
}You can give it a new tab by changing Root.Content.Main to Root.Content.Background
-
Re: Changing background on each page without tons of templates

22 January 2010 at 2:12pm
Where should the "background uploader" field show up?
I tried changing it from Root.Content.Main to Root.Content.Background to see if it would make any difference and it didn't.
Is there anything like the ?flush=1 that I need to do so that it rescans all of that Page.php file?I'm doing it exactly as I'm reading and not seeing any extra fields.. but maybe I'm not looking in the right place. I assume if I do the Root.Content.Background it would show up as another tab next to Main and Metadata? I did that and it doesn't show up and even tried sitename.com/admin/?flush=1 just to see.. and I tried changing it back to Root.Content.Main and do not see anything under the main tab for each page..
Any thoughts as to what I could be doing wrong? Or where I should be looking?
Thanks a lot!
-Greg
-
Re: Changing background on each page without tons of templates

22 January 2010 at 2:23pm
hm, could you pastie.org your code?
-
Re: Changing background on each page without tons of templates

22 January 2010 at 2:48pm
oh cool never used pastie before! very cool.
Page.php: http://pastie.org/789234
-
Re: Changing background on each page without tons of templates

22 January 2010 at 11:32pm
getCMSFields needs to be in class Page instead of class Page_Controller.
-
Re: Changing background on each page without tons of templates

23 January 2010 at 6:57am
Awesome! See I have no knowledge of php :-/ but once my schedule opens up a bit I will try to learn some basics to start off.
I now get the background upload field below the WYSIWYG text field but when I upload an image I get a very quick flash of some error then it goes back to the uploader field. So I tried "attach from file store" and there the image was in "uploads" directory I selected it and I get this error:
"Website Error
There has been an errorThe website server has not been able to respond to your request."
in the box where the background uploader field is.
Any thoughts?
And thanks a lot for the help!
-
Re: Changing background on each page without tons of templates

26 January 2010 at 10:19am
Been a few days with no reply so wanted to bump the thread if that's ok.
Does anyone know what could cause the error:
"Website Error
There has been an errorThe website server has not been able to respond to your request."
when trying to select an already uploaded background image?
I went to the uploads directory and the image had been uploaded successfully when I viewed it. -
Re: Changing background on each page without tons of templates

26 January 2010 at 10:53am
Website error could really mean anything....
Check your server error logs for more information and make shure your site is in devmode.
| 4002 Views | ||
| Go to Top | Next > |


