Welcome Guest, Not a member yet? Register   Sign In
How to set Pagination in order to redirect the page to the same url ?
#1

[eluser]Unknown[/eluser]
Hi !

I'm newbie in the Frameworks world. I've looked through lot others as well but the performance of CI was the best. I've started to learn it through the tutorials, but I would like to develop it to get more know-how in CI.
So under this message I attached the code that response the first page and it's entries with the pagination script. But it isn't work well because there is some problem with the url and I don't know how i should modify to work properly ! So ... How should I modify the script to this action handle the
http://localhost/blog/ and the http://localhost/blog/index.php?test=test&page=2 url query as well.

Can someone help me ?

THX ! :-)

function index(){
$data['title']="CodeIgniter blog";
$data['heading']="My blog heading";
$this->load->library('pagination');
$config['base_url'] = 'http://localhost/blog/index.php?test=1';
$config['page_query_string']=true;
$config['total_rows'] = $this->db->count_all('entries');
$config['per_page'] = '2';
$this->pagination->initialize($config);
if($this->uri->segment(2) == false ){
$start=0;
}else if($this->uri->segment(2) == true){
$start=$this->uri->segment(2);
}
$limit=2+$start;
$data['query']=$this->db->get('entries',$limit,2);
$data['pager'] = $this->pagination->create_links();
$this->load->view('blog_view',$data);

}


Messages In This Thread
How to set Pagination in order to redirect the page to the same url ? - by El Forum - 09-06-2009, 09:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB