Welcome Guest, Not a member yet? Register   Sign In
Pagination Class Problem in codeigniter CodeIgniter_2.1.0?
#1

[eluser]somenet[/eluser]
In codeigniter_2.1.0 the $config['use_page_numbers'] = TRUE; not return actual data if we use use_page_numbers.Anyone solved this problem.Please help me.
#2

[eluser]Zaher Ghaibeh[/eluser]
can you put your full code (config & controller)
so people can help you ..
#3

[eluser]somenet[/eluser]
If use use_page_numbers = true in pagination class then it don't fetch actual record.As well as the total record also not fetch you can check using pagination class in codeigniter 2.1.0.
#4

[eluser]Unknown[/eluser]
This will work only when per_page is 3, if you change it you must change change if statements too. .
Here is my Controller code


class Data extends CI_Controller {


public function index()
{


$this->load->library('pagination');

$this->load->library('table');
$config['base_url']='http://localhost/pagination/index.php/data/index';
$config['total_rows']=$this->db->get('data')->num_rows();




$config["full_tag_open"]="<div id='pagination' >";
$config["full_tag_close"] ="</div>" ;
$config['first_link'] =false;
$config['last_link']=false;
$config['cur_tag_open'] = ' <b class="active">';
$config['cur_tag_close'] = '</b>';


$config['use_page_numbers'] = TRUE
$config['num_links']=2;

$config['use_page_numbers'] = TRUE;
$config['per_page']=3;



$this->pagination->initialize($config);


$k=$this->uri->segment(3);

$offset=$k;

if($k==0)
{
$offset=$k;
// echo "00";
}

else if($k==2)
{
$offset=$k+1;
//echo "2222";
}
else if($k==3)
{
$offset=2*$k;
//echo "3333";
}
else
{
$offset=((2*$k)+1);
// echo "44";
}


$data['records']=$this->db->get('data',$config['per_page'],$offset );

$this->load->view('site_view',$data);


}
}




Theme © iAndrew 2016 - Forum software by © MyBB