Welcome Guest, Not a member yet? Register   Sign In
Search result and pagination class
#22

[eluser]bluepicaso[/eluser]
My code for previous project was this
Code:
function search()
    {
        $key = $this->input->post('key');
        $what = $this->input->post('what');
        $tags = $key;
        $tags=ltrim($tags);
        $tags=rtrim($tags);
        if(($tags == "") || ($tags == null))
        {
             $data['response'] ="Oopps, seems you did not enter the keywords";
             $data['response_image'] = 'error.png';
             $data['color']='red';
             $data['page'] = base_url();
             $data['alt'] = "";
             $this->load->view('ok', $data);
        }
        else
        {
             //echo $keyword;
             redirect("welcome/searching/$key/$what");    
        }
    }
    
    function searching($keyword, $what)
    {
        $tags = $keyword;
        $tags=ltrim($tags);
        $tags=rtrim($tags);
        $kt=split("_",$tags);//<------- Using the Split() working fine
        $q="";
      
      //----------------------------WHEN BOTH ARE ALL-----oNLY KEY WORD SEARCH IS NEEDED------------
        
        {
            $data['pageId'] = 2;
            while(list($key,$val)=each($kt))
              {
                        if($val<>" " and strlen($val) > 0)
                        {
                             $val=ltrim($val);
                             $val=rtrim($val);
                            $q .="details like '%$val%' or ";
                        }
              }
              $q=substr($q,0,(strLen($q)-3));
              //echo ($q);
              
              $this->load->library('pagination');
              $config['base_url'] = base_url() . "welcome/searching/$keyword/$what";
              
                    if($what == "jwls")
                    {
                        $config['total_rows'] = $this->db->count_all("normal where ".$q);    
                    }
                    elseif($what == "gems")
                    {
                        $config['total_rows'] = $this->db->count_all("gems where ".$q);    
                    }
              
              $config['per_page'] = '20';
              //$config['page_query_string'] = TRUE;
              $config['full_tag_open'] = '<p>';
              $config['full_tag_close'] = '</p>';
              $config['uri_segment'] = 5;
              $data['best'] = @$this->get->getBest();
              $this->pagination->initialize($config);
              
              
                    if($what == "jwls")
                    {
                        $data['gotSearchedJwl'] = @$this->get->getSearchedJwl($keyword, $config['per_page'],$this->uri->segment(5));
                        if($data['gotSearchedJwl'] == null)
                        {
                            $data['gotSearchedJwl'] ="none";
                        }
                    }
                    elseif($what == "gems")
                    {
                        $data['gotSearchedJwl'] = @$this->get->getSearchedGem($keyword, $config['per_page'],$this->uri->segment(5));
                        if($data['gotSearchedJwl'] == null)
                        {
                            $data['gotSearchedJwl'] ="none";
                        }
                    }
                    //print_r($data['gotSearchedJwl']);
                    if($what == "gems")
                    {
                        $data['mainContent'] = "searchedListGem";
                    }
                    else
                    {
                        $data['mainContent'] = "searchedListJwl";
                    }
                    $this->load->view('includes/template', $data);
        }
    }


Messages In This Thread
Search result and pagination class - by El Forum - 06-21-2009, 05:24 AM
Search result and pagination class - by El Forum - 06-21-2009, 05:42 AM
Search result and pagination class - by El Forum - 06-21-2009, 05:53 AM
Search result and pagination class - by El Forum - 06-21-2009, 05:55 AM
Search result and pagination class - by El Forum - 06-21-2009, 06:01 AM
Search result and pagination class - by El Forum - 06-21-2009, 06:10 AM
Search result and pagination class - by El Forum - 06-21-2009, 06:25 AM
Search result and pagination class - by El Forum - 06-21-2009, 07:21 AM
Search result and pagination class - by El Forum - 06-21-2009, 04:57 PM
Search result and pagination class - by El Forum - 06-22-2009, 09:15 AM
Search result and pagination class - by El Forum - 06-22-2009, 09:22 AM
Search result and pagination class - by El Forum - 06-22-2009, 11:42 AM
Search result and pagination class - by El Forum - 08-23-2009, 10:44 AM
Search result and pagination class - by El Forum - 08-23-2009, 01:59 PM
Search result and pagination class - by El Forum - 08-23-2009, 08:45 PM
Search result and pagination class - by El Forum - 04-06-2010, 08:20 PM
Search result and pagination class - by El Forum - 04-21-2010, 06:03 AM
Search result and pagination class - by El Forum - 04-21-2010, 07:45 AM
Search result and pagination class - by El Forum - 05-04-2010, 11:13 PM
Search result and pagination class - by El Forum - 05-05-2010, 02:29 AM
Search result and pagination class - by El Forum - 05-05-2010, 04:32 AM
Search result and pagination class - by El Forum - 05-05-2010, 04:53 AM
Search result and pagination class - by El Forum - 05-05-2010, 04:54 AM
Search result and pagination class - by El Forum - 05-05-2010, 05:15 AM
Search result and pagination class - by El Forum - 05-05-2010, 05:31 AM
Search result and pagination class - by El Forum - 05-05-2010, 05:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB