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.

Archive /

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

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


Go to End

2 Posts   1276 Views


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.


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() {


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;


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.