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

Tutorial 2: Parse error: parse error, unexpected T_VARIABLE in C:\lighttpd\htdocs\tutorial\code\ArticlePage.php on line 19


Go to End


1401 Views

Avatar
OldLady

Community Member, 1 Post

18 February 2008 at 11:37am

Edited: 18/02/2008 11:37am

I'm just going through the second tutorial and am getting an error after adding this:

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');

return $fields;
}

to the ArticlePage file - any ideas?

Full file now looks like this:

<?php
/**
* Defines the ArticlePage page type
*/

class ArticlePage extends Page {

static $db = array(
'Date' => 'Date',
'Author' => 'Text'
);

static $has_one = array(
);

function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');

return $fields;
}

}

class ArticlePage_Controller extends Page_Controller {

}

?>