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.

General Questions /

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

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

Extending a basic site - blank page after rebuiling database.


Go to End


3 Posts   1035 Views

Avatar
ynotintx

Community Member, 2 Posts

8 September 2011 at 1:43am

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

Avatar
MarcusDalgren

Community Member, 288 Posts

8 September 2011 at 1:50am

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.

Avatar
ynotintx

Community Member, 2 Posts

8 September 2011 at 2:27am

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