Jump to:

23375 Posts in 18175 Topics by 2866 members

General Questions

SilverStripe Forums » General Questions » Extending a basic site - blank page after rebuiling database.

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 535 Views
  • ynotintx
    Avatar
    Community Member
    2 Posts

    Extending a basic site - blank page after rebuiling database. Link to this post

    I am new to SilverStripe so I know this is probably my lack of knowledge but in following Step II I keep getting a blank page after flushing

    ArticlePage.php
    <?php
    /**
    * Defines the ArticlePage page type
    */
    class ArticlePage extends Page {
    static $db = array(
    'Date' => 'Date',
    'Author' => 'Text'
    );
    static $has_one = array(
    );

    }

    class ArticlePage_Controller extends Page_Controller {

    }

    ?>

    I am supposed to add this -

    function getCMSFields() {
    $fields = parent::getCMSFields();

    $fields->addFieldToTab('Root.Content.Main', new DateField('Date'), 'Content');
    $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');

    return $fields;
    }
    }

    so now the file 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 DateField('Date'), 'Content');
    $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');

    return $fields;
    }
    }

    }

    class ArticlePage_Controller extends Page_Controller {

    }

    ?>

    When I flush the CMS I get a blank page.

    Thank you in advance for any help.
    Tony

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Extending a basic site - blank page after rebuiling database. Link to this post

    In the code you posted there's one bracket too many. Remove the third bracket after return $fields so it 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 DateField('Date'), 'Content');
    $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');

    return $fields;
    }
    }

    class ArticlePage_Controller extends Page_Controller {

    }

    ?>

    Let us know if that fixes it.

  • ynotintx
    Avatar
    Community Member
    2 Posts

    Re: Extending a basic site - blank page after rebuiling database. Link to this post

    Thank you so much for the fast response, great support!

    That allowed me to add the "News" ArticleHolder but when I try to create the an Article Page clicking "Go" button nothing happens. Haven't searched yet about this but just thought you might know of top of head. Thanks again!!! Tony

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