Guest User

Untitled

a guest
May 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2. /**
  3. * Defines the PreviousNext page type
  4. */
  5. class PreviousNextPage extends Page {
  6. static $db = array(
  7. );
  8. static $has_one = array(
  9. );
  10. }
  11.  
  12. class PreviousNextPage_Controller extends ContentController {
  13.  
  14. public function nextPager() {
  15. $where = "ParentID = ($this->ParentID + 0) AND Sort > ($this->Sort + 0 )";
  16. $pages = DataObject::get("SiteTree", $where, "Sort", "", 1);
  17. if($pages) {
  18. foreach($pages as $page) {
  19. return $page;
  20. }
  21. }
  22. }
  23. public function previousPager() {
  24. $where = "ParentID = ($this->ParentID + 0) AND Sort < ($this->Sort + 0)";
  25. $pages = DataObject::get("SiteTree", $where, "Sort DESC", "", 1);
  26. if($pages) {
  27. foreach($pages as $page) {
  28. return $page;
  29. }
  30. }
  31. }
  32. }
  33.  
  34. ?>
Add Comment
Please, Sign In to add comment