Welcome Guest, Not a member yet? Register   Sign In
Pagination wrong work
#1

[eluser]rad11[/eluser]
I try do a image gallery with help pagination but have problem with it. My pagination doesnt highlights for a number of page and hill doest work. When I change with ma link http://localhost/ci/media_ctrl/gallery/galeria1/1 or 2 or 3 images changing but not with pagination Sad

View
Code:
<?php
        
        
        foreach($query_all->result() as $row){
        
        echo anchor($row->image_url, "<img  >image_url' />");
        echo form_hidden('images[]', $row->id_image);
        
        }
        
        foreach($query->result() as $row){
        
        echo '<div  center;">';
        echo "<img  >image_url' />";
        echo '</div>';
        
        }
        echo '<div  center;">';
        echo $this->pagination->create_links();
        echo '</div>'
        ?&gt;

Controller
Code:
public function gallery($folder_name){

$config['base_url'] = 'http://localhost/ci/media_ctrl/gallery/' . $folder_name . '/';
$config['total_rows'] = $this->db->get('images')->num_rows();
$config['per_page'] = 1;
$config['num_links'] = 5;
$config['full_tag_open'] = '<div class="pagination_articles">';
$config['full_tag_close'] = '</div>';

$uri = $this->uri->segment(4);
$this->pagination->initialize($config);
    
$data['query_all'] = $this->model_media->show_images_from_folder($folder_name);
$data['query'] = $this->model_media->show_images_from_folder_pag($folder_name, $config['per_page'], $uri);
    
$this->load->view('media/show_folder_images_view', $data);
}

Model
Code:
public function show_images_from_folder_pag($folder_name, $config, $uri){
        $this->db->select('*');
        $this->db->from('images i');
        $this->db->join('create_folder f', 'i.id_folder = f.id_folder');
        $this->db->where('f.folder_name', $folder_name);
        $this->db->limit(1, $uri);
        $query = $this->db->get();
        return $query;
    }
#2

[eluser]Tpojka[/eluser]
Check this tut, it worked for me.
#3

[eluser]rad11[/eluser]
Yeah, ok i checked. But I want do like I started Smile
#4

[eluser]InsiteFX[/eluser]
For one you need to pass the $offset to your method!
#5

[eluser]rad11[/eluser]
You mean limit 1, 1 ?
#6

[eluser]rad11[/eluser]
Is something wrong with segment $folder_name because with out it pagination work good any sugestion?




Theme © iAndrew 2016 - Forum software by © MyBB