Ive been working through tutorial 2 and i can not get author and date fields to work can someone please help.
ArticlePage.php
<?php
/**
*Defines the ArticlePage page type
*/
class ArticlePage extends Page {
static $db = array(
'Date' => 'Date',
'Author' => 'Text'
);
static $has_one = array(
);
static $icon = "themes/tutorial/images/treeicons/news";
static $defaults = array(
'ProvideComments' => true
);
}
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', $dateField = new DateField('Date','Article Date (for example: 20/12/2010)'), 'Content');
$datefield->setConfig('showCalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author','Author Name'), 'Content');
return $feilds;
}
class ArticlePage_Controller extends Page_Controller {
}
?>
ArticlePage.ss
<% include Menu2 %>
<div id="Content" class="typography">
<% include Breadcrumbs %>
<h1>$Title</h1>
$Content
<div class="newsDetails">
Posted on $Date.Nice by $Author
</div>
$PageComments
</div>
ArticleHolder.php
<?php
/**
* Defines the ArticleHolder page type
*/
class ArticleHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $icon = "themes/tutorial/images/treeicons/news";
static $allowed_children = array('ArticlePage');
}
class ArticleHolder_Controller extends Page_Controller {
function rss() {
$rss = new RSSFeed($this->Children(), $this->Link(), "The coolest news around");
$rss->outputToBrowser();
}
function init() {
RSSFeed::linkToFeed($this->Link() . "rss");
parent::init();
}
}
?>
ArticleHolder.ss
<div id="Content" class="typography">
$Content
<ul id="NewsList">
<% control Children %>
<li class="newsDateTitle"><a href="$Link" title="Read more on "{$Title}"">$Title</a></li>
<li class="newsDateTitle">$Date.Nice</li>
<li class="newsSummary">$Content.FirstParagraph <a href="$Link" title="Read more on "{$Title}"">Read more >></a></li>
<% end_control %>
</ul>
</div>