php - Codeigniter Pagination view -
i new on codeigniter , need find out way.
controller, here fetch data :
<?php class propertymodel extends ci_model { function __construct() { // call model constructor parent::__construct(); } public function pagination() { $this->load->view('templates/header'); $this->load->library('pagination'); $this->load->library('table'); $config['base_url']='http://localhost/goldenacre/property/pagination'; $config['total_rows']= $this->db->get('property')->num_rows(); $config['per_page']= 10; $config['num_links']=5; $this->pagination->initialize($config); $config['total_rows']=$this->db->get('property')->num_rows(); $data['records']=$this->db->get('property',$config['per_page'],$this->uri->segment(3)); $this->load->view('listvieww',$data); $this->load->view('templates/footer'); }
view page
<html> <h1>my pagination</h1>` <?php echo $this->table->generate($records); ?> <?php echo $this->pagination->create_links(); ?>
my whole code work not working per requirements. need show this.
its shown in table, need show on way in div or <article> </article>
tag or in loop.
in config array send paging library, can add
$config['full_tag_open'] = '<article>'; $config['full_tag_close'] = '</article>'; $this->pagination->initialize($config);
you can customize first, last, next, previous , current links: have on documentation here: https://ellislab.com/codeigniter/user-guide/libraries/pagination.html
Comments
Post a Comment