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, biapar, Willr, Ingo, simon_w

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


Reply


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

}

?>