[eluser]Herton Vilarim[/eluser]
Hello! I'm new to CodeIgniter and I have a little problem, I created a
paging for a photo album so that changing from page 1 to 2 is
caught on the first link, the content changes, the more the links remains the 1
selected. I would like to know a solution, here's the code.
Controller
Code:
function verfotos(){
$config['base_url'] = "http://localhost/camara/index.php/site/verfotos/".$this->uri->segment(3)."/";
$this->db->where('id_album',$this->uri->segment(3));
$config['total_rows'] = $this->db->get('fotos')->num_rows();
$config['por_pagina'] = 12;
$config['first_link'] = 'First';
$config['last_link'] = 'Last';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Prev';
$this->pagination->initialize($config);
$this->db->where('id_album',$this->uri->segment(3));
$query = $this->db->get('fotos',$config['per_page'],$this->uri->segment(4));
$data['conteudo'] = 'fotos';
$data["paginacao"] = $this->pagination->create_links();
$data['query'] = $query;
$this->load->view('template',$data);
}
View
Code:
<h1>Fotos</h1>
<div id="pag_fotos">
<ul>
<?php foreach($query->result() as $row): ?>
<li class="thumbnail">
<a >img; ?>" rel="lightbox[plants]" title="<?php echo $row->nome; ?>"><img >img; ?>" width="180" height="120" alt="Plants: image 1 0f 4 thumb" /></a>
</li>
<?php endforeach; ?>
</ul>
<div id="pagination">
<br />
<br />
<p><strong>Paginação</strong></p>
<p><?php echo $paginacao; ?></p>
</div>
</div>