17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1479 Views |
-
new image field

9 October 2007 at 2:06pm Last edited: 9 October 2007 4:18pm
Hi
I added a new image field, but I get the following error in the CMS:
Fatal error: Class 'HTTP' not found in /home/newhorizonsforwomen/sapphire/core/model/DataObject.php on line 90
I had added them as follows:
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo1'));
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo2'));Sometimes it works but most of the time I get the error above.
Any ideas?
Nicolaas
-
Re: new image field

9 October 2007 at 2:09pm
Another pageType only adds one image:
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo1'));
For this one, I get the following error (no right-hand-side is shown at all).
Fatal error: Class 'SQLMap' not found in /home/newhorizonsforwomen/sapphire/security/Group.php on line 90
Curious....
I am using the latest version of ss
-
Re: new image field

9 October 2007 at 2:11pm
The complete class is as follows:
class LargeRightPanelPage extends Page {
static $db = array();
static $has_one = array();
static $icon = "...";
function getCMSFields() {
$fields = parent::getCMSFields();
//$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo1'));
$fields->addFieldToTab('Root.Content.Quotes', new TextareaField('Quote'));
$fields->addFieldToTab('Root.Content.Quotes', new TextField('Person'));
$fields->addFieldToTab('Root.Content.Quotes', new TextField('Organisation'));
return $fields;
}
} -
Re: new image field

9 October 2007 at 11:41pm
Do you not have to add those fields to the database in order to be able to edit them in the CMS?
class LargeRightPanelPage extends Page {
static $db = array(
'Quote' => 'HTMLText',
'Person' => 'Varchar',
'Organisation' => 'Varchar'
);
static $has_one = array(
'Photo1' => 'Image'
);HTMLText is from memory and might not be a valid data type - check the docs.
-
Re: new image field

10 October 2007 at 11:07am Last edited: 10 October 2007 11:37am
Hi,
Thanks for your response.... I had already added the database fields. No problems there - I think. Here is the whole class:
static $icon = "...";
static $db = array(
'Quote' => 'Text',
'Person' => 'Text',
'Organisation' => 'Text'
);
static $has_one = array(
'Photo1' => 'Image',
'Photo2' => 'Image'
);
public function nextPager() {
$pages = DataObject::get("SiteTree", "ParentID = ($this->ParentID + 0) AND Sort > ($this->Sort + 0 )", "Sort", "", 1);
if($pages) {
foreach($pages as $page) {
$v = '<a href="#subHeading-'.$page->URLSegment.'" onclick="return !showHide(\''.$page->URLSegment.'\');">next: '.$page->Title.'</a>';
}
}
return $v;
}public function previousPager() {
$pages = DataObject::get("SiteTree", "ParentID = ($this->ParentID + 0) AND Sort < ($this->Sort + 0)", "Sort DESC", "", 1);
if($pages) {
foreach($pages as $page) {
$v = '<a href="#subHeading-'.$page->URLSegment.'" onclick="return !showHide(\''.$page->URLSegment.'\');" >previous: '.$page->Title.'</a>';
}
}
return $v;
}
}
| 1479 Views | ||
|
Page:
1
|
Go to Top |

