Advertisement
vanchelo

Untitled

Oct 3rd, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. public function paginate($limit = 10, $last_id = null)
  2. {
  3.     $q = $this->newQuery();
  4.  
  5.     $q->select(['id','pagetitle','какие-то поля']);
  6.  
  7.     $where = ['published' => 1, 'deleted' => 0, 'parent' => $this->parent];
  8.  
  9.     if ($last_id) {
  10.         $where['id:<'] = $last_id;
  11.     }
  12.  
  13.     $q->where($where);
  14.  
  15.     $q->limit($limit);
  16.  
  17.     $q->sortby('id', 'DESC');
  18.  
  19.     return $q->fetch(true);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement