Welcome to UAP Docs - Paginator
public function __construct(){ parent::__construct(); // Set number of rows per page ('10') $this->pages_limit = "10"; $this->pages = new \Helpers\Paginator($this->pages_limit); } public function page($id, $current_page = null){ $data['items'] = $this->model->items($id, $this->pagesTopic->getLimit($current_page, $this->pages_limit)); // Set total number of messages for paginator $total_num_items = count($this->model->items($id)); $this->pages->setTotal($total_num_items); // Send page links to view $pageFormat = DIR."Items/$id/"; // URL page where pages are $data['pageLinks'] = $this->pages->pageLinks($pageFormat, null, $current_page); }
public function forum_topics($where_id, $limit = null){ $data = $this->db->select(" SELECT * FROM items_db WHERE item_cat = :where_id GROUP BY item_id ORDER BY item_id DESC $limit ", array(':where_id' => $where_id)); return $data; }
// Display Paginator Links // Check to see if there is more than one page if($data['pageLinks'] > "1"){ echo "<div class='panel panel-info'>"; echo "<div class='card-header h4 text-center'>"; echo $data['pageLinks']; echo "</div>"; echo "</div>"; }