Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Defines the PreviousNext page type
- */
- class PreviousNextPage extends Page {
- static $db = array(
- );
- static $has_one = array(
- );
- }
- class PreviousNextPage_Controller extends ContentController {
- public function nextPager() {
- $where = "ParentID = ($this->ParentID + 0) AND Sort > ($this->Sort + 0 )";
- $pages = DataObject::get("SiteTree", $where, "Sort", "", 1);
- if($pages) {
- foreach($pages as $page) {
- return $page;
- }
- }
- }
- public function previousPager() {
- $where = "ParentID = ($this->ParentID + 0) AND Sort < ($this->Sort + 0)";
- $pages = DataObject::get("SiteTree", $where, "Sort DESC", "", 1);
- if($pages) {
- foreach($pages as $page) {
- return $page;
- }
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment