0
votes

I am experiencing some problems with Codeigniters Pagination Class.

The problem is that "page 1" remains bold, even though the change in the URL.

My url looks like this:

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

uri->segment(3) is the per_page and the uri->segment(4) is the page number.

I have set the $config['uri_segment'] = 4; as you see in the code below.

Anyone who might see what's wrong with the code?

Thank you..

/** 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);
2

2 Answers

1
votes

If your DB record, I mean result is proper in the page. And you only face the issue with "first bold link" then you can set the style (css) of as below:

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

You will have to make the css as below: .Frist_PAGE_STYLE_CLASS { text-weight:normal; }

0
votes

Try adding current_page in the config array manually, and set it to

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

It might work for you..