CodeIgniter Forums
Pagination problem, How I can remove the current page from right side ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forum-11.html)
+--- Thread: Pagination problem, How I can remove the current page from right side ? (/thread-73887.html)



Pagination problem, How I can remove the current page from right side ? - sarath_unrelax - 06-18-2019

Hello,

I have pagination, Everything works fine. But I need to remove current page from right side.

Here it is 7 (In Screenshot)


My code :

PHP Code:
$this->load->library('pagination');
 
           $config = array();
 
           $config["base_url"] = base_url() . "rent";
 
           $config["total_rows"] = $this->listing_model->countListing("Rent");
 
           $config["per_page"] = 12;
 
           $config["uri_segment"] = 2;
 
           $config['full_tag_open'] = '<nav aria-label="Page navigation"><ul class="pagination">';
 
           $config['full_tag_close'] = '</ul></nav>';
 
           $config['next_link'] = 'Next';
 
           $config['prev_link'] = 'Previous';
 
           $config['next_tag_open'] = '<li>';
 
           $config['next_tag_close'] = '</li>';
 
           $config['prev_tag_open'] = '<li>';
 
           $config['prev_tag_close'] = '</li>';
 
           $config['num_tag_open'] = '<li>';
 
           $config['num_tag_close'] = '</li>';
 
           $config['first_link'] = 'First';
 
           $config['last_link'] = 'Last';
 
           $config['cur_tag_open'] = '<li class="active">';
 
           $config['cur_tag_close'] = '</li>';
 
           $config['first_link'] = FALSE;
 
           $config['last_link' FALSE;


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

 
           $page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;

 
           $data["links"] = $this->pagination->create_links(); 



RE: Pagination problem, How I can remove the current page from right side ? - neuron - 06-18-2019

it looks like it is a CSS styling problem not related to backend code.

some styles given to .active class making it to display in this way


RE: Pagination problem, How I can remove the current page from right side ? - InsiteFX - 06-18-2019

I have seen that also before and it was due to extra code in the html file
on the end of the statement.

This was a bootstrap html page with a font awesome <i> tag.


RE: Pagination problem, How I can remove the current page from right side ? - sarath_unrelax - 06-19-2019

(06-18-2019, 03:56 AM)InsiteFX Wrote: I have seen that also before and it was due to extra code in the html file
on the end of the statement.

This was a bootstrap html page with a font awesome <i> tag.
Where I can change that buddy


RE: Pagination problem, How I can remove the current page from right side ? - jreklund - 06-19-2019

You can't remove it with Codeigniter, it's hardcoded in there. You will need to hide it with CSS.

Code:
ul.pagination li.active {display: none;}

Or better yet style it. Here is a bootstrap example:
https://getbootstrap.com/docs/4.3/components/pagination/#disabled-and-active-states


RE: Pagination problem, How I can remove the current page from right side ? - sarath_unrelax - 06-19-2019

@jreklund

Buddy, still not working


RE: Pagination problem, How I can remove the current page from right side ? - sarath_unrelax - 06-19-2019

screenshot is in attachment what I'm actually looking for.

Actually Code from the template 

Code:
<nav aria-label="Page navigation">
                   <ul class="pagination">
                       <li>
                           <a href="properties-list-leftside.html" aria-label="Previous">
                               <span aria-hidden="true">«</span>
                           </a>
                       </li>
                       <li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
                       <li><a href="properties-list-leftside.html">2</a></li>
                       <li><a href="properties-list-fullwidth.html">3</a></li>
                       <li>
                           <a href="properties-list-fullwidth.html" aria-label="Next">
                               <span aria-hidden="true">»</span>
                           </a>
                       </li>
                   </ul>
               </nav>




My Codeigniter pagination config

PHP Code:
public function sale()
{
 
   $this->load->library('pagination');
 
           $config = array();
 
           $config["base_url"] = base_url() . "sale";
 
           $config["total_rows"] = $this->listing_model->countListing("Sale");
 
           $config["per_page"] = 12;
 
           $config['num_links'] = 2;
 
           $config['full_tag_open'] = '<nav aria-label="Page navigation"><ul class="pagination">';
 
           $config['full_tag_close'] = '</ul></nav>';
 
           $config['next_link'] = 'Next';
 
           $config['prev_link'] = 'Previous';
 
           $config['next_tag_open'] = '<li>';
 
           $config['next_tag_close'] = '</li>';
 
           $config['prev_tag_open'] = '<li>';
 
           $config['prev_tag_close'] = '</li>';
 
           $config['num_tag_open'] = '<li>';
 
           $config['num_tag_close'] = '</li>';
 
           $config['first_link'] = 'First';
 
           $config['last_link'] = 'Last';
 
           $config['cur_tag_open'] = '<li class="active">';
 
           $config['cur_tag_close'] = '</li>';
 
           $config['first_link'] = FALSE;
 
           $config['last_link' FALSE;


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

 
           $page = ($this->uri->segment(2)) ? $this->uri->segment(2) : 0;

 
           $data["links"] = $this->pagination->create_links();
 
           $data['listRecords'] = $this->listing_model->showListing("Sale"$config["per_page"], $page);
 
           $data['title'] = 'Sale';
 
           $data['main_content'] = 'sale';
 
           $this->load->view('template'$data);





RE: Pagination problem, How I can remove the current page from right side ? - sarath_unrelax - 06-19-2019

Can you make necessary changes and help out me with it ?


RE: Pagination problem, How I can remove the current page from right side ? - jreklund - 06-19-2019

This is a CSS matter. And can't be changed with Codeigniter settings.

https://www.w3schools.com/cssref/pr_background-color.asp
https://www.w3schools.com/cssref/pr_text_color.asp

Apply your styling inside this tag.

Code:
ul.pagination li.active {
background-color: green;
...
...
...
}