Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » ArticlePage code not working... pointers???

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1175 Views
  • Josh
    Avatar
    SilverStripe Developer
    65 Posts

    ArticlePage code not working... pointers??? Link to this post

    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.

  • SilverRay
    Avatar
    Community Member
    167 Posts

    Re: ArticlePage code not working... pointers??? Link to this post

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

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

    Does this help?

  • Josh
    Avatar
    SilverStripe Developer
    65 Posts

    Re: ArticlePage code not working... pointers??? Link to this post

    Yep that worked great!

    Thanks heaps!

    1175 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.