Welcome Guest, Not a member yet? Register   Sign In
Code Extinguisher Search Pagination
#1

[eluser]ocergyNohtna[/eluser]
Hi all. I've got an older version of CE (I believe it's codex2_rc13) I've been customizing for some time and was wondering if anyone has already resolved the issue I plan to tackle. The search functionality works great, but the pagination doesn't work properly. When you click a pagination link after a search it goes back to /index/20 showing all of the records from the table instead of the second set of search results. Can anyone shed any light on an easy resolve to this? This is the search function I have in codexController:
Code:
function search(){
        $this->search_keywords = ($this->input->post('query') != '') ? $this->input->post('query') : $this->getQuickJumpData('query');
        $this->search_fields = ($this->input->post('fields') != '') ? $this->input->post('fields') : $this->getQuickJumpData('fields');

        if(count($this->search_keywords) != count($this->search_fields))
            show_error("Problem with setup of keywords vs fields...");

        if($this->jump_action == FALSE) {
            for($i=0;$i<count($this->search_keywords);$i++){
                $this->db->like($this->search_fields[$i],$this->search_keywords[$i]);
            }
        }
        
        $this->codexcrumbs->add(strtolower($this->controller_link),'Overview');
        $this->codexcrumbs->add('Search');

        $this->setupQuery();
        //Retrieve all the records
        $query = $this->db->get($this->table);
        $max_rows = $query->num_rows();

        $result = $query->result_array();
        //Split it up for pagination
        $result = array_slice($result,$this->first_item,$this->on_one_page);

        $result = $this->prepForDisplay($result);
        
        $data['add_link'] = $this->add_link;
        $data['entries'] = $result;
        $data['messages'] = $this->codexmessages->get();
        
        if($max_rows > $this->on_one_page){
            $data = array_merge($data,$this->setupPagination($max_rows));
        }
        $this->codextemplates->loadView($this->config->item('codex_layout_dir').$this->view_mode,$data);
        $this->codextemplates->setTitle($this->page_header.$this->lang->line('codex_overview_title'));
        $this->codextemplates->printHTML();

    }
Does it make more sense to fix this here or in the codexPagination. Any assistance would be appreciated.




Theme © iAndrew 2016 - Forum software by © MyBB