0
私はGET
レコード検索方法を使用しています。今、私がページングを適用したとき、次のページページリンクにデータを提出する方法を理解できません。 私はこれを試しましたanswer。リンクセグメントにページ番号を積み重ねるだけです。ページネーション送信値を取得するcodeigniter
例:? はlocalhost/PHC /検索/結果/ 0から
S =が& product_catを愛=すべて& post_type =製品
にはlocalhost/PHC /検索/結果/ ?s = ai & product_cat = all & post_type = product/12/24
私はそのコードを使用しませんでした。
そして今、私のコードは次のとおりです。
public function results() {
//pagination
$offset = $this->uri->segment(3);
$limit = 12;
//$offset = 0;
$data['limit'] = $limit;
$config['base_url'] = base_url() . 'search/results/';
$config['first_url'] = base_url() .'search/results/0';
$data['total'] = $this->All_data_model->countSearchProducts($_GET);
$config['total_rows'] = $data['total'];
$config['per_page'] = $limit;
$config['uri_segment'] = 3;
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$data['offset'] = $offset;
$data['total_rows'] = $config['total_rows'];
$data['page'] = 'search';
$data['navbar'] = $this->All_data_model->navbarContent();
$data['products'] = $this->All_data_model->searchResults($_GET , $offset , $limit);
$this->template->write_view('content', 'products/search', $data);
$this->template->render();
}
は私がこのデータにアクセスできるか、この場合にデータを提出するための最良の方法はないにGET
、どのように伝えます。
'$ config ['reuse_query_string'] = TRUE;'はあなたが探しているものです。 –