Welcome Guest, Not a member yet? Register   Sign In
please , is it possible to call function in model ?
#1

[eluser]ludo31[/eluser]
Hello , I don't know how to explain my problem but I try to make it clear : I have 3 tables (shoes - gender - and style )
in my view I create a menu where there is : Men - Women so when we click on it must show all shoes for men ..
and another nav bar : all style : baskets - boots etc .. and when i click on it , it must shoes all clicked style for example style basket ..

but my problem is in menubar I have a dropdown menu for example in men > basket > boots etc ..

so in my controller I create functions for each case : Men . women .. and also for each style basket - boots etc ..

Code:
public function ManageMen(){...}
public function ManagewoMen(){...}
public function ManageBasket(){...}

and this code work well it shoes all shoes according to gender and style but the problem is about the submenu that is to say for Men > basket (I would like to show just men shoes and basket style it mean I must create another function in controller

Code:
public function ManageBasketMen(){...}
but normally it is the ManageMen and Manage basket together

May be you asked why I don't have pass the value to paremeter , and my answer is I can't because i must manage the pagination after for example (about just men case ) in view file

Code:
<dt> <a href="&lt;?php echo site_url('client/ManageMen/'); ?&gt;" title="Homme">Men</a> </dt>

and in controller client.php file

Code:
public function ManageMen()
        {
            
            // here I can't catch a parameter from view file because I must
            // do it for pagination
            
            $offset = $this->uri->segment(3);
            $limit = 4 ;
            
            $config['base_url']='http://localhost/MonSite/index.php/client/gestionHomme';
                
// in the table gender  id is 1
  
            $config['total_rows']= $this->client_model->getRowGenre(1);
            
            $config['num_links']=5;  
            
            $config['per_page']= $limit;
            
            $config['full_tag_open']='<div id="pagination">';
            
             $config['full_tag_close']='</div>';
            
             $config['next_link']='>>';
            
              $config['prev_link']='<<';
              
              $this->pagination->initialize($config);
              
                      
            $data['rows'] =$this->client_model->getHomme($config['per_page'],$this->uri->segment(3));
      
                $data['title']='Bienvenue Messieurs';
               $data['content']='homme_view';
      
          //$this->load->view('homme_view',$data);
       $this->load->view('template/template',$data);
            
              
            
            
        }
so the first problem is for that I create for each case a similar function for Women - Children - basket etc ...

my second problem is for submenu (if I would like to show the men basket )

Code:
public function ManageBasketmen(){...}

and in my model :

Code:
getShoes(idgender){...where id_gender = idgender ;}

getShoesStyle(idstyle){...where id_style = idstyle ;}

an in my submenu I would like to combine those 2 functions because here I would like to show all men shoes and basket style

so we can make a simple function using join

Code:
getShoesStyle(idstyle,idgender){and here we use join}

but my problem is If I proced like this I must make it for all style because it is impossible to pass the parameter when user click on a link ...
so I try to catch each click by the concerned name of function

did you have an advice in order to improve those code and this case

thanks




Theme © iAndrew 2016 - Forum software by © MyBB