Welcome Guest, Not a member yet? Register   Sign In
Pagination parameters - page_query_string?
#1

[eluser]GeXus[/eluser]
Right now the pagination is doing like this &page_page=2 to the URL's, but i'd like it to just do /2 - I've set page_query_string to false for the pagination config, but that doesn't seem to do anything. I have my site setup to use query strings for google analytics purposes, but everything else uses the url segments...

Thanks!
#2

[eluser]harman[/eluser]
------Controller---------------------
Code:
//Count Total Record From Table Name = Same as Class Name
         $data['totalrecords']=$this->db->count_all($this->class_name);

        $config['base_url'] = base_url().$this->controller_name."/index/";
           /* don't ignore segments Change According your req.*/
        $config['uri_segment'] = 4;
        $config['per_page']=10;
        $config['total_rows'] = $data['totalrecords'];
        $config['full_tag_open'] = '<div class="pagination"><div class="icon pagination-ico"></div>';
        $config['full_tag_close'] = '</div>';
        $config['cur_tag_open'] ='<span class="current">';
        $config['cur_tag_close']='</span>';
        
        $model = $this->class_name.'_mod';
        $this->load->model($this->controller_name."_mod");
        
        $data['dloop'] = $this->$model->getList($config['per_page'],(int)$this->uri->segment(4));
        
        $this->pagination->initialize($config);
        
        $data["controllerName"]=$this->controller_name;

        $data["sno"]=(int)$this->uri->segment(4);
        
        $this->data['dynamicContent'].=$this->load->view($this->controller_name."_view",$data,true);


-------------model----------------------
Code:
function getList($num, $offset){
          $sql_q="SELECT  "Fields"
                  FROM
                          "Tables"
                  WHERE
                          "Your Conditions"
                  Limit ?,?";
          
           $query = $this->db->query($sql_q,array($offset,$num));
           $iret=FALSE;
            if($query->num_rows()>0){
                $iret=$query->result_array();
            }
            //Free Result
            $query->free_result();
            return $iret;
    }

---------View---------------------------------

Code:
&lt;?php echo $this->pagination->create_links(); ?&gt;

         //Create List by using foreach   on $dloop


note: Some Functions Are created by me , just for understand,
warning : don't copy paste without understand..(may not work)




Theme © iAndrew 2016 - Forum software by © MyBB