Codeigniter中的分页页面未正确突出显示

时间:2019-01-30 17:46:25

标签: codeigniter pagination

                  //Load pagination and configure
                    $config['total_rows'] = $totRecords;
                    $config['per_page'] = $recs_per_page;
                    $config['page_query_string'] = TRUE;
                    $config['base_url'] =  '/test/pagination/';
                    $data['base_url'] = $config['base_url'];
                    if (count($_GET) > 0) $config['suffix'] = '?' . urldecode(http_build_query($_GET, '', "&"));
                    $config['first_url'] = $config['base_url'].'?'.urldecode(http_build_query($_GET));
                    $config['full_tag_open'] = '<div class="dataTables_paginate paging_bootstrap pagination"><ul>';
                    $config['full_tag_close'] = '</ul></div>';
                    $config['first_link'] = FALSE;
                    $config['last_link'] = FALSE;
                    $config['prev_link'] = 'Previous';
                    $config['prev_tag_open'] = '<li class_alias()s="prev{class}">';
                    $config['prev_tag_close'] = '</li>';
                    $config['cur_tag_open'] = '<li class="active"><a href="#">';
                    $config['cur_tag_close'] = '</a></li>';
                    $config['num_tag_open'] = '<li>';
                    $config['num_tag_close'] = '</li>';
                    $config['next_tag_open'] = '<li class="next{class}">';
                    $config['next_tag_close'] = '</li>';
                    $config['next_link'] = 'Next';
                    $config['display_prev_link'] = TRUE;
                    $config['display_next_link'] = TRUE;
                    $config['num_links'] = 7;
                    $this->pagination->cur_page = $offset;
                    $this->pagination->initialize($config);

上面是我的config [],它已经显示每页结果,但是当我单击2、3、4、5等中的任何数字时,页码未突出显示

1 个答案:

答案 0 :(得分:0)

我通过更改ff来解决上述问题:

                    $config['page_query_string'] = TRUE;
                    $get =  urldecode(http_build_query($_GET));
                    if (count($_GET) > 0) {
                        $expsuf = explode("&", $get, 2);
                        $uri = $expsuf[1];
                        $config['suffix'] = "&".$uri;


                       $config['first_url'] = $config['base_url'].'?'.$uri;
                   }