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.

General Questions /

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

Extending a basic site - blank page after rebuiling database.


Reply


3 Posts   573 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