Welcome Guest, Not a member yet? Register   Sign In
[Pagination] Numbering data in pagination
#4

[eluser]bretticus[/eluser]
In your controller:

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

$offset = ( $this->uri->segment(3) === FALSE ) ? '0' : $this->uri->segment(3);
$data['offset'] = $offset;

$config['base_url'] = site_url('tags');
$config['total_rows'] = $this->tags->count_all();
$config['per_page'] = '20';

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

$data['tags'] = $this->tags->get_all($config['per_page'], $offset);
$data['page_links'] = $this->pagination->create_links();

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

In your view:

Code:
<ul class="listing">
&lt;?php foreach ($tags as $tag_id => $tag): ++$offset?&gt;
  <li>&lt;?=$offset?&gt;. &lt;?=$tag?&gt;</li>
&lt;?php endforeach; ?&gt;
</ul>


Messages In This Thread
[Pagination] Numbering data in pagination - by El Forum - 09-28-2010, 08:51 PM
[Pagination] Numbering data in pagination - by El Forum - 09-28-2010, 10:38 PM
[Pagination] Numbering data in pagination - by El Forum - 09-28-2010, 11:57 PM
[Pagination] Numbering data in pagination - by El Forum - 09-29-2010, 08:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB