Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. class HomePage_Controller extends Page_Controller {
  2.  
  3. /**
  4. * An array of actions that can be accessed via a request. Each array element should be an action name, and the
  5. * permissions or conditions required to allow the user to access it.
  6. *
  7. * <code>
  8. * array (
  9. * 'action', // anyone can access this action
  10. * 'action' => true, // same as above
  11. * 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
  12. * 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
  13. * );
  14. * </code>
  15. *
  16. * @var array
  17. */
  18. private static $allowed_actions = array (
  19. 'latestBlogPosts','testFunction'
  20. );
  21.  
  22. public function init() {
  23. parent::init();
  24. // You can include any CSS or JS required by your project here.
  25. // See: http://doc.silverstripe.org/framework/en/reference/requirements
  26. }
  27. function latestBlogPosts(){
  28. $blog = BlogPost::get()->sort('PublishDate','DESC')->limit(4);
  29. return $blog;
  30. }
  31.  
  32. function testFunction() {
  33. return 'test';
  34. }
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement