Jump to:

5451 Posts in 1673 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [SOLVED]Tutorial problem - News fields don't display

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

Page: 1
Go to End
Author Topic: 186 Views
  • Cgull
    Avatar
    Community Member
    23 Posts

    [SOLVED]Tutorial problem - News fields don't display Link to this post

    Hello,

    I started learning ss today and I am following the tutorials.

    I am at tutorial number 2: Extending a basic site http://doc.silverstripe.org/framework/en/tutorials/2-extending-a-basic-site

    I have created the ArticlePage and ArticleHolderPage but when I go and create a page of type ArticleHolder there are no date and author fields in the content tab.

    My code for the ArticlPage:

    class ArticlePage extends Page
    {
       static $db = array(
                 'Date'=>'Date',
                 'Author'=>'Text'
              );
    }

    class ArticlePage_Controller extends Page_Controller
    {
       public function getCMSFields()
       {
          $fields = parent::getCMSFields();
          
          $dateField = new DateField('Date');
          $dateField = setConfig('showcalendar', true);
          $fields->addFieldToTab('Root.Main', $dateField, 'Content');
          $fields->addFieldToTab('Root.Main', new TextField('Author'), 'Content');
          
          return $fields;
       }
    }

    Am I doing something wrong?

    Thank you

  • Cgull
    Avatar
    Community Member
    23 Posts

    Re: [SOLVED]Tutorial problem - News fields don't display Link to this post

    Ok, I found one mistake I've made which is putting the getCMSFields function in the wrong class.

    Moved it from the ArticlePage_Controller class to ArticlePage class.

    Flushed the site, always do, still nothing.

    Please, can someone help?

  • Cgull
    Avatar
    Community Member
    23 Posts

    Re: [SOLVED]Tutorial problem - News fields don't display Link to this post

    Ok, refreshed again, now I see the fields under the content field.

    In the tutorial they are above the content field, maybe that's why I didn't see them on my site. Not sure.

    186 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.