21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 676 Views |
-
Adding an Images Tab in the backend

29 March 2011 at 11:13pm
Hi Everyone,
Having a bit of a problem that I hope someone could help me out with. Im trying to add an images tab in the backend. So the page is called PartnersPage.php and here is what i've added:
<?php
class PartnersPage extends Page {
static $db = array(
'Heading' => 'Text',
'SubHeading' => 'Text',
'WebLink' => 'Text'
);
static $has_one = array(
'TopPhoto' => 'Image');
function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab('Root.Content.Main', new TextField('Heading'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('SubHeading'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('WebLink'), 'Content');
$fields->addFieldToTab("Root.Content.Images", new ImageField('TopPhoto'));return $fields;
}
}class PartnersPage_Controller extends Page_Controller {
}
But as soon as I add the Image Field the website goes down and says
"Sorry, there was a problem with handling your request.
Visit www.silverstripe.org to download the CMS"Is this a common problem is there a simple fix for it?
-
Re: Adding an Images Tab in the backend

3 June 2011 at 4:48am Last edited: 3 June 2011 4:53am
I have the same problem. Have you find an answere?
My code:
<?php
/**
* Defines the SideBarPage page type
*/class SideBarPage extends Page {
static $icon = "images/treeicons/sidebar";
static $db = array(
);static $has_one = array(
'Photo1' => 'Image',
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('RightSide');
$fields->removeByName('BannerImage');
$fields->removefieldFromTab("Root.Content.Main","Content");
$fields->removefieldFromTab("Root.Content.Main","SideBarPage");
$fields->addFieldToTab( 'Root.Content.Images', new ImageField('Photo1') );return $fields;
}static $defaults = array(
'ShowInMenus' => false ,
'ShowInSearch' => false
);
}class SideBarPage_Controller extends Page_Controller {
}
?>And the result: "Sorry, there was a problem with handling your request."
/Johan
| 676 Views | ||
|
Page:
1
|
Go to Top |


