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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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


1480 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 {

}

?>