0

CodeignitersPaginationClassで問題が発生しています。

問題は、URLを変更しても、「ページ1」が太字のままになることです。

私のURLは次のようになります:

http://mypage.com/s/search+str/4/1

uri-> segment(3)はper_pageであり、uri-> segment(4)はページ番号です。

$ config ['uri_segment']=4;を設定しました。以下のコードでわかるように。

コードの何が問題になっているのかわかる人はいますか?

ありがとうございました..

/** Load The Search model **/
    $this->load->model('search_model');

    /** Perform the search **/
    $this->search_model->set_search_str(decode_url($str));

    // prettyPrint($config['per_page']); die();
    $offset = $this->uri->segment(4,0);

    /** Pagination **/
    $this->load->library('pagination');
    $config = array (
            'uri_segmet'       => 4,
            'per_page'         => $this->uri->segment(3, 25),
            'total_rows'       => $this->search_model->get_nums(),
            'num_links'        => 4,
            'base_url'         => base_url()."s/{$str}/".$this->uri->segment(3, 25),
            'use_page_numbers' => TRUE
        );

$this->pagination->initialize($config);

$pagination_links = $this->pagination->create_links();

    $query = $this->search_model->search( $config['per_page'], $offset );

    $num_results = $this->search_model->get_nums();

    /** Set the theme data **/
    $data = array(
        'title'         => 'Search page',
        'page'          => 'search',
        's_str'         => decode_url($str),
        'num_results'       => $num_results,
        'results'       => $query['results'][0],
        'pagination'        => $pagination_links
    );

    /** Load the theme  **/     
$this->load->theme($data);
4

2 に答える 2

1

DBレコードの場合、結果はページで適切であることを意味します。そして、あなたは「最初の太字のリンク」でのみ問題に直面します、そしてあなたは以下のようにスタイル(css)を設定することができます:

$ config ['first_link'] ='First_PAGE_STYLE_CLASS';

次のようにcssを作成する必要があります。.Frist_PAGE_STYLE_CLASS{text-weight:normal; }

于 2012-04-21T12:46:47.820 に答える
0

構成配列にcurrent_pageを手動で追加して、次のように設定してください。

$data['current_page'] = $this->uri->segment(4);

それはあなたのために働くかもしれません。

于 2012-04-22T07:09:40.160 に答える