无法访问受保护的属性CI_Pagination

时间:2017-06-13 13:38:27

标签: php forms codeigniter submit

无法访问受保护的属性`CI_Pagination

尝试在页面的最后一页上添加提交按钮当前它在每个页面上默认...在第49行我有条件检查我是否在最后一页,我想要一个提交按钮在分页页面的结尾

显示错误的代码..请说明如何实现

if($this->pagination->cur_page >= ceil($this->pagination->total_rows / $this->pagination->per_page))
{
    $isLastPage = true; 
}else{
    $isLastPage = false;
}

分页代码

public function quizdisplay()
{   
    //echo $this->pagination->create_links();

    //$this->load->library('pagination');
    $config = array();
    $config['base_url'] = 'http://localhost/xampp/cii/index.php/Questions/quizdisplay';
    //$config['total_rows'] = 10;
    $total_row = $this->quizmodel->record_count();
    $config["total_rows"] = $total_row;
    $config['per_page'] = 1;
    $config["uri_segment"] = 3;
    $config['use_page_numbers'] = TRUE;
    $config['num_links'] = $total_row;
    $config['cur_tag_open'] = '&nbsp;<a class="current">';
    $config['cur_tag_close'] = '</a>';
    $config['next_link'] = 'Next';
    $config['prev_link'] = 'Previous';

    $this->pagination->initialize($config);
    if($this->uri->segment(3)){
        $page = ($this->uri->segment(3)) ;
    }else{
        $page = 1;
    }

    $data["results"] = $this->quizmodel->getQuestions($config["per_page"], $page);
    $this->pagination->create_links();
    $data["links"] = $this->pagination->create_links();
    View data according to array.
    $this->load->view("play_quiz", $data);
}

两个代码都是相同的功能

0 个答案:

没有答案