コーディニターページネーションクラスにはいくつかの問題があります。コーディネーターページネーション - 最初のページは太字で表示されます
URLの変更があっても、「ページ1」は太字のままです。
私のURLは次のようになります。(3)PER_PAGEおよびURI>セグメントである
http://mypage.com/s/search+str/4/1
uri->セグメント(4)のページ番号です。
私は$ config ['uri_segment'] = 4を設定しました。あなたが以下のコードで見るように。
コードに間違いがあると思われる人は誰ですか?あなたのDBのレコードは、私が意味する結果がページに適切である場合
は...
/** 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);
ちょうどそれを試してみました..しかし、それはいずれか動作しないようですか?私はそれを理解できません。私はdie()の後に4番目のuriセグメントのprint_rを実行しようとしました。それは正しい値を得ますか?私には奇妙に思えます。私はbase_urlと何か関係がありますか? – Thomas
私は少し速かったです!私は、ページ区切りクラスの変数の名前として 'cur_page'に 'current_page'をキャンギャルしようとしましたが、今は動作します!奇妙なことに、私は何のページか教えてください:)ありがとう! – Thomas