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

ArticlePage code not working... pointers???


Reply


3 Posts   1212 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!