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

ArticlePage code not working... pointers???


Go to End


3 Posts   1496 Views

Avatar
Josh

SilverStripe Developer, 65 Posts

16 January 2008 at 1:32pm

Hey guys,

Just beginning to extend the basic site using the tutorial... trying to mix and match some code and it just crashes my install.

Can anyone see anything wrong with the below?

<?php

class FeatureArticlePage extends Page {
static $db = array(
'Date' => 'Date'
'Author' => 'Text'
);
static $has_one = array(
'Photo' => 'Image'
);
static $defaults = array(
'ProvideComments' => true
);
function getCMSFields() {
$fields = parent::getCMSFields();

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

return $fields;
}
}

class FeatureArticlePage_Controller extends Page_Controller {

}

?>

Cheers in advance.

Avatar
SilverRay

Community Member, 167 Posts

16 January 2008 at 3:42pm

There needs to be a comma in your static $db (after 'Date'), like so:

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

Does this help?

Avatar
Josh

SilverStripe Developer, 65 Posts

22 January 2008 at 12:02pm

Yep that worked great!

Thanks heaps!