Welcome Guest, Not a member yet? Register   Sign In
problem pagination
#1

[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>
&lt;?php foreach($query->result() as $row): ?&gt;
        
        <li class="thumbnail">
        <a >img; ?&gt;" rel="lightbox[plants]" title="&lt;?php echo $row->nome; ?&gt;"><img >img; ?&gt;" width="180" height="120" alt="Plants: image 1 0f 4 thumb" /></a>
        </li>
  
&lt;?php endforeach; ?&gt;
</ul>
<div id="pagination">
<br />
<br />
<p><strong>Paginação</strong></p>
<p>&lt;?php echo $paginacao; ?&gt;</p>
</div>
</div>
#2

[eluser]Herton Vilarim[/eluser]
I found the solution! as I was using the url segment 4 had to
configure the array of paging segment which I was using, since it comes
as the default value 3. Here is the solution for those who have the same
issue




Theme © iAndrew 2016 - Forum software by © MyBB