Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function NavigationLink($direction){
- switch($direction){
- case 'next':
- $sort = 'Sort:GreaterThan';
- break;
- case 'prev':
- $sort = 'Sort:LessThan';
- break;
- default:
- return false;
- }
- $page = BlogPage::get()->filter(array(
- 'ParentID' => $this->ParentID,
- $sort => $this->Sort
- ))->sort('Sort ASC')->first();
- return $page;
- }
- public function BlogNavigation($class = 'blog-navigation'){
- if($prev = self::NavigationLink('prev')){
- $prevLink = '<li><a href="'.$prev->Link().'">'.$prev->Title.'</li>';
- }else{
- $prevLink = '';
- };
- if($next = self::NavigationLink('next')){
- $nextLink = '<li><a href="'.$next->Link().'">'.$next->Title.'</a></li>';
- }else{
- $nextLink = '';
- };
- return '<ul class="'.$class.'">'.$prevLink.$nextLink.'</ul>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement