• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI pagination help

#1
[eluser]umefarooq[/eluser]
im trying to use CI pagination and its creating pagination but facing one problem is that when i move from page 1 to 2 it not showing link on 1 and also not showing first and < links always showing > and last> links and 1 is always without link here is my line of codes which im using.

Code:
$this->load->library('pagination');
            
$config['base_url'] = base_url().'index.php/admin/content/view';
$config['total_rows'] = $this->contentmodel->getCount('wm_content');
$config['per_page'] = '5';
            
$this->pagination->initialize($config);
            
$data['count'] = $this->uri->segment(4);
$data['page'] = $this->pagination->create_links();;
$data['rows'] = $this->contentmodel->getContents('wm_content',$config['per_page'],$data['count']);

any body has solution to this problem

#2
[eluser]umefarooq[/eluser]
can anybody help me about the problem.

#3
[eluser]majidmx[/eluser]
The only config variable that you're missing is "uri_segment":
Code:
$config['uri_segment'] = 4;

$this->pagination->initialize($config);
Try to set that one as well and see if it's working.

Take care,
MajiD Fatemian

#4
[eluser]umefarooq[/eluser]
hi thanks its working really good.

#5
[eluser]umefarooq[/eluser]
again thanks my another question about pagination is how to set any css class for the pagination to make it styled with css.

#6
[eluser]majidmx[/eluser]
Hi,
As they are all made by <a> tags, the best way is to wrap them in a <div> like this :
Code:
<div id='pagination_wrapper'>
    &lt;?PHP echo $pagination; ?&gt;
</div>

and then in your CSS file you can do it like this :
Code:
#pagination_wrapper a{
    font-family:Verdana;
    font-size:....
}
#pagination_wrapper a:hover{
    /*some other style*/
}

Let me know if it solved your problem.
MajiD Fatemian

#7
[eluser]umefarooq[/eluser]
that is the first option which i already have in my mind another thing is that we can not put direct class or id in a tag.

#8
[eluser]majidmx[/eluser]
can you explain more about the restrictions you have because in that case someone will have better ideas about your situation.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.