mercredi 7 juin 2017

how i can apply rule based in codeigniter?

My project is about a color suitable for house. If he choose a type is bedroom and the size is small, the result is light color. Hope you guys can help. I'm new in codeigniter field :). I hope you guys can help me in model and view too

Here is my code in controller

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

 
class AutoSuggestion extends CI_Controller {
        
        function __construct()  {  

    parent::__construct();  
      $this->load->library('session');
      $this->load->helper('url');
      $this->load->helper('html');
      $this->load->database();
      $this->load->model('AutoSuggestion_model'); 
    
  } 

    public function some_action()
    {
                if (($Type_Name=='Room') && ($Size_Name=='Large'))
  {
    $this->load->view('A');
   }

   else if (($Type_Name=='Room') && ($Size_Name=='Medium'))
  {
    $this->load->view('B');
   }

      else if (($Type_Name=='Room') && ($Size_Name=='Small'))
  {
    $this->load->view('C');
   }

     else if (($Type_Name=='Bathroom') && ($Size_Name=='Large'))
  {
    $this->load->view('D');
   }
   
      else if (($Type_Name=='Bathroom') && ($Size_Name=='Medium'))
  {
    $this->load->view('E');
   }
   
      else if (($Type_Name=='Bathroom') && ($Size_Name=='Small'))
  {
    $this->load->view('F');
   }
   
      else if (($Type_Name=='Kitchen') && ($Size_Name=='Large'))
  {
    $this->load->view('G');
   }
   
     else if (($Type_Name=='Kitchen') && ($Size_Name=='Medium'))
  {
    $this->load->view('H');
   }
   
      else if (($Type_Name=='Kitchen') && ($Size_Name=='Small'))
  {
    $this->load->view('I');
   }    
}

Aucun commentaire:

Enregistrer un commentaire