Welcome Guest, Not a member yet? Register   Sign In
please , how to make a pagination for a precise request ??
#1

[eluser]ludo31[/eluser]
Hello ,
I need to make a pagination in order to show the result of this request : here is my controller :

Code:
public function gestionChaussureGenre()
             {
                $offset = $identifiantGenre =  $this->uri->segment(3);
                
                
                $data['rows'] = $this->client_model->getChaussureGenre($identifiantGenre);
                $data['ligne'] = $this->client_model->getRow($identifiantGenre);
                
              
                
                       //ligne 5        
              
              /* pagination configuration */
              
              $config['base_url']='http://localhost/MonSite/index.php/client/gestionChaussureGenre';
               $config['total_rows']= $data['ligne'];
                $config['per_page']=2;
                $config['num_links']=2;
                 $config['full_tag_open']='<div id="pagination">';
                 $config['full_tag_close']='</div>';
                   $config['next_link']='>>';
                    $config['prev_link']='<<';
                    
                     $this->pagination->initialize($config);
                    
                      // ce que je dois mettre ici

                $data['page'] = $this->client_model->getChaussureGenre($identifiantGenre, $config['per_page'],$this->uri->segment(3));
                
                
                     $this->load->view('homme_view',$data);
                
                
                
                
             }

in my model :

Code:
public function getChaussureGenre($identifiantGenre)
    {
        /* cette fonction sert a recuperer identifiant nom et image et prix
        * utile pour afficher dans la page accueil homme
        * */
        
        
       $this->db->select('id,nom,prix,nom_path');
       $this->db->from('chaussure');
       $this->db->join('gnr_convenir', 'gnr_convenir.identifiant_chaussure = chaussure.id');
       $this->db->join('images', 'images.id_chaussure = chaussure.id');
        $this->db->where('identifiant_genre', $identifiantGenre);  
        $this->db->order_by("id", "desc");
        
        $query = $this->db->get();
          
           $ligne= $query->num_rows();
          
                    if($query->num_rows()>0)
                       {
                         foreach($query->result()as $row)
                         {
                           $data[] = $row;
                         }
                        
                          
                      
        
                         return $data;
                        
                        
                       }
    }

and in my viex I make it simple because there are more rows :

Code:
&lt;body&gt;
// here I show
<div> etc ...</div >

&lt;?php echo $this->pagination->create_links();?&gt;
    
&lt;/body&gt;

my problem is here :
Code:
$data['page'] = $this->client_model->getChaussureGenre($identifiantGenre, $config['per_page'],$this->uri->segment(3));

is that correct or how to configure ??

I try the result but , it doesn't show correctly here I would like to show 2 per page and there are more

thanks




Theme © iAndrew 2016 - Forum software by © MyBB