How to Implement Pagination In Codeigniter Ion_auth Library? Web-development (jquery) How to Implement Pagination In Codeigniter Ion_auth Library?
How To Implement Pagination In Codeigniter ion_auth library?Controller
function display_user() { $this->data['title'] = "Display User"; if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin()) { redirect('auth', 'refresh'); } $this->load->library('pagination'); $config = array(); $config["base_url"] = base_url() . "auth/display_user/";; $config['total_rows'] = $this->ion_auth->users()->num_rows(); $config['per_page'] = '30'; //pagination customization using bootstrap styles $config['full_tag_open'] = ' <ul>'; $config['full_tag_close'] = '</ul><!--pagination-->'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li>'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li>'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li>'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li>'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $the_uri_segment = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0; $config['uri_segment'] = $the_uri_segment; //list the users $this->data['users'] = $this->ion_auth->offset($this->uri->segment($the_uri_segment))->limit($config['per_page'])->users()->result(); foreach ($this->data['users'] as $k => $user) { $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result(); } $this->data['links'] = $this->pagination->create_links(); //set the flash data error message if there is one $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message'); $this->data['include'] = 'auth/display_user'; $this->_render_page('auth/template', $this->data); }
View
<?php echo $links;?>
0 Response to "How to Implement Pagination In Codeigniter Ion_auth Library?"
Posting Komentar