CodeIgniter Forums
CI pagination help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CI pagination help (/showthread.php?tid=14419)



CI pagination help - El Forum - 01-02-2009

[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


CI pagination help - El Forum - 01-02-2009

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


CI pagination help - El Forum - 01-02-2009

[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


CI pagination help - El Forum - 01-02-2009

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


CI pagination help - El Forum - 01-02-2009

[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.


CI pagination help - El Forum - 01-03-2009

[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


CI pagination help - El Forum - 01-03-2009

[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.


CI pagination help - El Forum - 01-03-2009

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