Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Error


Go to End


2 Posts   1629 Views

Avatar
RobboNoCash

Community Member, 33 Posts

12 August 2015 at 2:06pm

Hi I have got a error in this code.
I don't know what the error is.
But if someone can take a look and see what the error is, and let me know that would be great.

Thanks

<?php
class Services extends Page {

public static $has_many = array(
'Servo' => 'ServicePart'
);

public function getCMSFields() {

$f = parent::getCMSFields();

$config = GridFieldConfig_RecordEditor::create();

//$config = GridFieldConfig_RelationEditor::create();

$servicetext = new GridField("Servo", "Servo", $this->Servo(), $config);
$f->addFieldToTab('Root.Events', $servicetext);
// $f->addFieldToTab('Root.Main', new TextField('Head'), 'Content');

return $f;

}

}

class Services_Controller extends Page_Controller {

public function init() {
parent::init();
}

}

<?php
class ServicePart extends DataObject {

public static $db = array(
'HeadingService' => 'Text',
'DescriptionText' => 'Text'
);

public static $has_one = array(
'Page' => 'Page',
'Image' => 'Image'
);

public function getCMSFields() {
$f = new FieldList();

$f->push( new TextField('HeadingService', 'Heading for service') );
$f->push( new TextField('DescriptionText', 'Description for service') );

return $f;
}
}
?>

Avatar
Pyromanik

Community Member, 419 Posts

12 August 2015 at 10:22pm

If you're using v3.1, they need to be private static.
never ?> on pure PHP files.