Vogelfrey

index stuff

Feb 11th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1.     public function __construct()
  2.     {
  3.         parent::__construct(\Base::instance()->get('DB'), 'members');
  4.     }
  5.  
  6.     public function index($f3)
  7.     {
  8.         $collection = new self();
  9.  
  10.         $limit = 10;
  11.         $page = $f3->get('PARAMS.page');
  12.         $paginateLink = $page;
  13.         $pageresults = $page * $limit;
  14.  
  15.  
  16.         $collection->fields(array('username', 'email')));
  17.         $thing = $collection->paginate(0, $limit, null, [
  18.             'order' => 'username asc',
  19.         ]);
  20.  
  21.         if ($page != null) {
  22.             $f3->set('previous', $paginateLink - 1);
  23.         }
  24.         if ($page != $thing['count']) {
  25.             $f3->set('next', $paginateLink + 1);
  26.         }
  27.  
  28.         $f3->set('pagecount', $thing['count']);
  29.         $f3->set('members', $thing['subset']);
  30.         $f3->set('content', 'userlist.html');
  31.         echo Template::instance()->render('index.html');
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment