2012-07-30 4 views
0

CodeIgniter 페이지 매김의 속성을 설정했지만 오류가 발생합니다.CodeIgniter 페이지 매김이 작동하지 않습니다.

1 2 3 4 5 > 

내 페이지 매김은 페이지 번호 1을 제외한 2-5 페이지에서 작동합니다. 왜 그런 일이 발생하는지 알지 못합니다. 여기 컨트롤러 이름이 c_forum 인 컨트롤러 기능이 있습니다.

function show_posts_by_chapter($id_chapter=false) { 
    if($id_chapter==false) 
     show_404(); 


    $config = array(); 
    $config["base_url"] = base_url() . "index.php/c_forum/show_posts_by_chapter/" . $id_chapter.'/'; 
    $config['total_rows'] = $this->m_forum->num_rows_by_chapter($id_chapter); 

    $config['per_page'] = 2; 
    $configp['uri_segment'] = 4; 

    $choice = $config["total_rows"]/$config["per_page"]; 
    $config["num_links"] = round($choice); 
    $this->pagination->initialize($config); 
    $page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0; 

    $data['chapter_id'] = $id_chapter; 
    $data['allowed'] = $this->_get_level(); 
    $data['count_rows'] = $config['total_rows']; 


    $data['posts_all'] = $this->m_forum->get_posts_by_chapter($config['per_page'], $page, $id_chapter); 
    $data['links'] = $this->pagination->create_links(); 
    $this->load->view('forum/show_posts', $data); 
} 

보기 간단

`<?php echo $links; ?>` 

당함 answe : I는 $configp['uri_segment'] = 4; 사용하고 $config['uri_segment'] = 4;

+0

"밑줄 없음"이란 무엇을 의미합니까? –

+0

사진을 업로드하고 싶다면 쉽게 가져올 수 있습니다. 그러나 여기에서 새로 만듭니다. 하지만 메인 테마는 내가 5를 얻은 다음에 다음에 히트하면 2가 아니라 1이된다. –

+0

아마도'$ config [ "num_links"]'일 것입니다. 제거하면 어떻게됩니까? –

답변

0

$의 configp [ 'uri_segment'] = 4이어야한다;
이것은
이어야합니다. $ config [ 'uri_segment'] = 4;

관련 문제