codeigniter 2分页不适用于_remap

时间:2013-04-03 12:33:44

标签: php view pagination codeigniter-2

Paginator正在为第二页的页面加载404页面。 Gues问题在此控制器中存在的_remap方法中。

我的分页器:

   $this->config->load('pagination', TRUE);
    $config = array_merge($this->config->item('pagination'), Array(
        'base_url'   => site_url() . "/welcome",
        'total_rows'  => count($commentsOfInterview),
        'per_page'   => 2,
        'uri_segment'  => 2,
    ));
    $this->pagination->initialize($config);

    $page = ($this->uri->segment(1)) ? $this->uri->segment(1) : 1;
    $commentsList['comments'] = $this->em->getRepository('Entities\Comment')->findPageOfActive($page, $config["per_page"], 'DESC', $lastInterviewId);
    $commentsList['links'] = $this->pagination->create_links();

Paginator正在加载但是对于2页的页面,它加载了404页。如何解决这个问题而不是删除_remap?

1 个答案:

答案 0 :(得分:0)

    public function _remap($method) {
        if(method_exists($this, $method)){
            if( $this->em->getRepository('Entities\User')->getUserId() === null && $this->em->getRepository('Entities\User')->getUserRole() !== 'VISITOR'){
                $this->em->getRepository('Entities\User')->setUserRole('VISITOR');
                $options=array(
                    'client_id' => 'interview',
                    'client_secret' => 'interview',

                );
                $params=array(
                    'scope'=>'email',
                    'cur_uri' => 'http://192.168.0.129/index.php/' . $this->uri->uri_string(),
                    'redirect_uri' => 'http://192.168.0.129/index.php/UserController/authorise/muloqot',  //?connect=muloqot',

                );
                $client = new Oauth2_MuloqotClientAPI($options);
                $client->isAuthorized($params);
            }
/*            else if($this->em->getRepository('Entities\User')->getUserRole() === 'VISITOR'){
                $this->em->getRepository('Entities\User')->deleteSessionData();
            }*/
            if ($this->uri->segment(3)) {
                return $this->$method($this->uri->segment(3));
            } else return $this->$method();
        } else {
            $error404 = site_url($this->router->routes['404_override']);
            redirect($error404);
        }
    }