2012-04-21 11 views
0

コーディニターページネーションクラスにはいくつかの問題があります。コーディネーターページネーション - 最初のページは太字で表示されます

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); 

答えて

0

てみ手動で設定配列にCURRENT_PAGEを追加し、それが主な問題は、CSSではありません

+0

ちょうどそれを試してみました..しかし、それはいずれか動作しないようですか?私はそれを理解できません。私はdie()の後に4番目のuriセグメントのprint_rを実行しようとしました。それは正しい値を得ますか?私には奇妙に思えます。私はbase_urlと何か関係がありますか? – Thomas

+0

私は少し速かったです!私は、ページ区切りクラスの変数の名前として 'cur_page'に 'current_page'をキャンギャルしようとしましたが、今は動作します!奇妙なことに、私は何のページか教えてください:)ありがとう! – Thomas

1

、ありがとうございました。そして、あなたは「最初の太字のリンク」で問題に直面し、次にスタイル(css)を以下のように設定することができます:

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

あなたは以下のようにCSSを作成する必要があります: .Frist_PAGE_STYLE_CLASS {text-weight:normal; }

+0

..あなたのために働くかもしれない

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

に設定します。 CIがアンカータグの最初のリンクをラップしないという問題は、ページ番号の残りの部分と同様です。それは、ページが4番目のURIセグメントで変化していることを検出しないような継ぎ目です。しかし、私は何が間違っているのか分かりません。 – Thomas

関連する問題