21307 Posts in 5737 Topics by 2603 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, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 340 Views |
-
Extending a basic site - blank page after rebuiling database.

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 -
Re: Extending a basic site - blank page after rebuiling database.

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.
-
Re: Extending a basic site - blank page after rebuiling database.

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
| 340 Views | ||
|
Page:
1
|
Go to Top |

