Sorry guys, neither version is giving the desired result! And yes, I am using the standard SilverStripe blog module.
Page.php code follows. Not sure if I've put it in the right place but...
<?php
class Page extends SiteTree {
private static $db = array('SidebarHTML' => 'HTMLText'
);
private static $has_one = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields -> addFieldToTab("Root.Sidebar",new HTMLEditorField("SidebarHTML"));
return $fields;
}
}
class Page_Controller extends ContentController {
/**
* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
*
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
*
* @var array
*/
private static $allowed_actions = array (
);
public function init() {
//Function for the latest Blog Post
//function latestBlog(){
//$blog = DataObject::get("BlogEntry", "", "Date DESC", "", 3);
//return $blog;
//}
function LatestBlogPosts($num=3) {
return BlogPost::get()->sort('PublishDate','desc')->limit($num);
}
parent::init();
// You can include any CSS or JS required by your project here.
// See: http://doc.silverstripe.org/framework/en/reference/requirements
}