Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class HomePage_Controller extends Page_Controller {
- /**
- * 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 (
- 'latestBlogPosts','testFunction'
- );
- public function init() {
- parent::init();
- // You can include any CSS or JS required by your project here.
- // See: http://doc.silverstripe.org/framework/en/reference/requirements
- }
- function latestBlogPosts(){
- $blog = BlogPost::get()->sort('PublishDate','DESC')->limit(4);
- return $blog;
- }
- function testFunction() {
- return 'test';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement