I am attempting to make a custom news holder and article page per the docs here: https://docs.silverstripe.org/en/4/tutorials/extending_a_basic_site/
The news holder works fine but when attempting to edit the article page it only displays blank. It creates a default page but I cannot edit it.
This is the code in my NewsArticlePage.php:
<?php
class NewsArticlePage extends Page {
private static $db = array(
'PubDate' => 'Date',
'Author' => 'Text'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$dateField = new DateField('PubDate', 'Article Date');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'YYYY-MM-dd');
$fields->addFieldToTab('Root.Main', $dateField, 'Content');
$fields->addFieldToTab('Root.Main', new TextField('Author', 'Author Name'), 'Content');
return $fields;
}
}
class NewsArticlePage_Controller extends Page_Controller {
}
mysite/simple/NewsArticlePage.ss
<% include SideBar %>
<div class="content-container unit size3of4 lastUnit">
<article>
<h1>$Title</h1>
<div class="news-details"><p>Posted on $Date.Nice by $Author</p></div>
<div class="content">$Content</div>
</article>
$Form
</div>
Before anyone asks...Yes - I did do the obligatory dev/build and flush.