Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Pagination Links Problem
#1

[eluser]Ifan Yozari[/eluser]
I am using codeigniter and its pagination class. It has a problem and it looks something like this:

Quote: 1<br>
2<br>
next last

Here is my code for controller:

Quote:
Code:
$this->db->select('*');
        $this->db->from('subkategori');
        $getData = $this->db->get('');
        $a = $getData->num_rows();
        $config['base_url'] = site_url().'/admin/seesubcategory/'; //set the base url for pagination
        $config['total_rows'] = $a; //total rows
        $config['per_page'] = '12'; //the number of per page for pagination
        $config['uri_segment'] = 3; //see from base_url. 3 for this case
        $this->pagination->initialize($config); //initialize pagination
        $config['num_tag_open'] = '<div id="pagination">';  
        $config['num_tag_close'] = '</div>';

i have this code as my view:

Quote:
Code:
&lt;?php echo $this->pagination->create_links(); ?&gt;

and here is my css:
Quote:
Code:
#pagination a, #pagination strong {
  background: #e3e3e3;
  padding: 4px 7px;
  text-decoration: none;
  border: 1px solid #cac9c9;
  color: #292929;
  font-size: 13px;
}

#pagination strong, #pagination a:hover {
  font-weight: normal;
  background: #cac9c9;
         display: inline-block;
}

can anyone tell me what i have to do to make the page link can be in one line.<br>
Thanks all for any help.


#2

[eluser]Unknown[/eluser]
Code:
$this->pagination->initialize($config); //initialize pagination
        $config['num_tag_open'] = '<div id="pagination">';  
        $config['num_tag_close'] = '</div>';
$this->pagination->initialize($config); place it at the end and try again。
#3

[eluser]Ifan Yozari[/eluser]
thanks for your help, but after i put
Quote:
Code:
$this->pagination->initialize($config); //initialize pagination
in the end, it doesn't change the view
#4

[eluser]srpurdy[/eluser]
my guess is you have somewhere in your css an #pagination which probably defines the link as a larger sized div which makes the 2nd link appear under it. for example you probably have a specfic width or something or the css is designed to use the full width available. So each item is on a new line.

A Better option would be to make <div id="pagination"> inside the view file.

Code:
$config['cur_tag_open'] = '<a class="disabled" href="#">';
$config['cur_tag_close'] = '</a>';

for the active tag. so you can apply a style to the active page.

The way you have it now it's doing this.

<div id="pagination">1</div>
<div id="pagination">2</div>

I don't think that's what you really want...
#5

[eluser]Ifan Yozari[/eluser]
@srpurdy: thanks for your help, but after i try your suggestion, the link still not in one line, once again thanks
#6

[eluser]Ifan Yozari[/eluser]
Thanks to all of you, I already find a solution for the problem.
I just need to add

Code:
float: left;


in the css.




Theme © iAndrew 2016 - Forum software by © MyBB