[eluser]harman[/eluser]
------Controller---------------------
Code:
//Count Total Record From Table Name = Same as Class Name
$data['totalrecords']=$this->db->count_all($this->class_name);
$config['base_url'] = base_url().$this->controller_name."/index/";
/* don't ignore segments Change According your req.*/
$config['uri_segment'] = 4;
$config['per_page']=10;
$config['total_rows'] = $data['totalrecords'];
$config['full_tag_open'] = '<div class="pagination"><div class="icon pagination-ico"></div>';
$config['full_tag_close'] = '</div>';
$config['cur_tag_open'] ='<span class="current">';
$config['cur_tag_close']='</span>';
$model = $this->class_name.'_mod';
$this->load->model($this->controller_name."_mod");
$data['dloop'] = $this->$model->getList($config['per_page'],(int)$this->uri->segment(4));
$this->pagination->initialize($config);
$data["controllerName"]=$this->controller_name;
$data["sno"]=(int)$this->uri->segment(4);
$this->data['dynamicContent'].=$this->load->view($this->controller_name."_view",$data,true);
-------------model----------------------
Code:
function getList($num, $offset){
$sql_q="SELECT "Fields"
FROM
"Tables"
WHERE
"Your Conditions"
Limit ?,?";
$query = $this->db->query($sql_q,array($offset,$num));
$iret=FALSE;
if($query->num_rows()>0){
$iret=$query->result_array();
}
//Free Result
$query->free_result();
return $iret;
}
---------View---------------------------------
Code:
<?php echo $this->pagination->create_links(); ?>
//Create List by using foreach on $dloop
note: Some Functions Are created by me , just for understand,
warning : don't copy paste without understand..(may not work)