Hi all,
I am attempting to go through Tutorial 2 of SS
http://doc.silverstripe.org/doku.php?id=tutorial:2-extending-a-basic-site
Now I've got all the .ss and .php pages setup.
mysite\code\ArticleHolder.php
mysite\code\ArticlePage.php
mysite\code\HomePage.php
themes\tutorials\templates\Layouts\ArticleHolder.ss
themes\tutorials\templates\Layouts\ArticlePage.ss
themes\tutorials\templates\Layouts\HomePage.ss
Have done the dev flush, flush all etc
I can create a Article, Holder, Article Page or Homepage in the admin and under behaviour page type it will show whatever I have selected.
But back on the front end none of these templates appear to be being used.
I debug by going:
?showtemplate=1
and it always shows
themes.tutorial.templates.Page.ss
So my created templates aren't actually being used on the front end.
Heres my class files also:
mysite\code\ArticleHolder.php
<?php
/**
* Defines the ArticleHolder page type
*/
class ArticleHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $allowed_children = array('ArticlePage');
}
class ArticleHolder_Controller extends Page_Controller {
}
?>
mysite\code\ArticlePage.php
<?php
class ArticlePage extends Page {
static $db = array(
'Date' => 'Date',
'Author' => 'Text'
);
static $icon = "themes/tutorial/images/treeicons/news";
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
return $fields;
}
}
class ArticlePage_Controller extends Page_Controller {
}
?>
mysite\code\HomePage.php
<?php
/**
* Defines the HomePage page type
*/
class HomePage extends Page {
static $db = array(
);
static $has_one = array(
);
static $icon = "themes/tutorial/images/treeicons/home";
}
class HomePage_Controller extends Page_Controller {
function LatestNews($num=5) {
$news = DataObject::get_one("ArticleHolder");
return ($news) ? DataObject::get("ArticlePage", "ParentID = $news->ID", "Date DESC", "", $num) : false;
}
}
?>
Any help would be great