简体   繁体   中英

Codeigniter adding search term on each paginated links

I'm having problems in adding additional link segments at the end of each page number. For instance, I set the config of pagination to:

$config['base_url'] = site_url() . 'admin/employee/search/';

Now, each of the links may contain page numbers but I also want to include the search term.

Instead of having links like: 'mysite/admin/employee/search/1..2..3' on paginated numbers,

I want to have like this: 'mysite/admin/employee/search/mysearchterm/1..2..3'.

How would I do it?

Try this:

if($this->uri->segment(3)){
    $keyword = $this->uri->segment(3);
}
else if($this->input->get('keyword')){
    $keyword = $this->input->get('keyword');
}
$config['base_url']         = base_url().'home/paginate_search/'.$keyword.'/page/';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM