2015-05-07 45 views
2

我有以下的分頁樣式如何風格沒有配置分頁鏈接 - 笨

      <ul class="pagination"> 
          <li><a href="#"><i class="fa fa-long-arrow-left"></i>Previous Page</a></li> 
          <li class="active"><a href="#">1</a></li> 
          <li><a href="#">2</a></li> 
          <li><a href="#">3</a></li> 
          <li><a href="#">4</a></li> 
          <li><a href="#">Next Page<i class="fa fa-long-arrow-right"></i></a></li> 
          </ul><!--/.pagination--> 

我想使上面的靜態代碼動態不使用配置

<ul class="pagination"> 

<?php echo $this->pagination->create_links(); ?> 

</ul><!--/.pagination--> 

控制器

 $config['full_tag_open'] = "<ul class='pagination'>"; 
     $config['full_tag_close'] = "</ul>"; 
     $config['num_tag_open']  = '<li>'; 
     $config['num_tag_close'] = '</li>'; 
     $config['cur_tag_open']  = "<li class='disabled'><li class='active'><a href='#'>"; 
     $config['cur_tag_close'] = "<span class='sr-only'></span></a></li>"; 
     $config['next_tag_open'] = "<li>"; 
     $config['next_tagl_close'] = "</li>"; 
     $config['prev_tag_open'] = "<li>"; 
     $config['prev_tagl_close'] = "</li>"; 
     $config['first_tag_open'] = "<li>"; 
     $config['first_tagl_close'] = "</li>"; 
     $config['last_tag_open'] = "<li>"; 
     $config['last_tagl_close'] = "</li>"; 
     $this->pagination->initialize($config); 
+0

風格意味着'CSS'或者你想改變UL LI到div等? – Kamran

+0

我只是想讓上面的靜態代碼動態...類必須是相同的 –

+0

你可以分享你的控制器方法,你試過'$ this-> pagination-> initialize($ config);'和在配置數組你可以定義所有的開始和結束標籤。 – Kamran

回答

4

好吧,我已經盡力了,這個控制器代碼工作正常

$config['full_tag_open'] = "<ul class='pagination'>"; 
    $config['full_tag_close'] = '</ul>'; 
    $config['num_tag_open'] = '<li>'; 
    $config['num_tag_close'] = '</li>'; 
    $config['cur_tag_open'] = '<li class="active"><a href="#">'; 
    $config['cur_tag_close'] = '</a></li>'; 
    $config['prev_tag_open'] = '<li>'; 
    $config['prev_tag_close'] = '</li>'; 
    $config['first_tag_open'] = '<li>'; 
    $config['first_tag_close'] = '</li>'; 
    $config['last_tag_open'] = '<li>'; 
    $config['last_tag_close'] = '</li>'; 



    $config['prev_link'] = '<i class="fa fa-long-arrow-left"></i>Previous Page'; 
    $config['prev_tag_open'] = '<li>'; 
    $config['prev_tag_close'] = '</li>'; 


    $config['next_link'] = 'Next Page<i class="fa fa-long-arrow-right"></i>'; 
    $config['next_tag_open'] = '<li>'; 
    $config['next_tag_close'] = '</li>'; 


    $this->pagination->initialize($config); 

查看

<?php echo $this->pagination->create_links(); ?> 
1

在你的控制器中添加這個配置。

   $config['full_tag_open'] = "<ul class='pagination'>"; 
       $config['full_tag_close'] = '</ul>'; 
       $config['num_tag_open'] = '<li>'; 
       $config['num_tag_close'] = '</li>'; 
       $config['cur_tag_open'] = '<li class="active"><a href="#">'; 
       $config['cur_tag_close'] = '</a></li>'; 
       $config['prev_tag_open'] = '<li>'; 
       $config['prev_tag_close'] = '</li>'; 
       $config['first_tag_open'] = '<li>'; 
       $config['first_tag_close'] = '</li>'; 
       $config['last_tag_open'] = '<li>'; 
       $config['last_tag_close'] = '</li>'; 

       $config['next_link'] = 'Next Page'; 
       $config['next_tag_open'] = '<li><i class="fa fa-long-arrow-right"></i>'; 
       $config['next_tag_close'] = '</li>'; 

       $config['prev_link'] = 'Previous Page'; 
       $config['prev_tag_open'] = '<li><i class="fa fa-long-arrow-left"></i>'; 
       $config['prev_tag_close'] = '</li>'; 
       $this->pagination->initialize($config); 

,並在您的視圖僅僅只有回聲分頁

<?php echo $this->pagination->create_links(); ?> 

刪除ul