CodeIgniter Forums
Pagination: Previous link on the second page shall not display page number in link - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Pagination: Previous link on the second page shall not display page number in link (/showthread.php?tid=59651)



Pagination: Previous link on the second page shall not display page number in link - El Forum - 10-31-2013

[eluser]indapublic[/eluser]
Hello, everyone. I have a trouble with Codeigniter Pagination and can not resolve it. My config (only part):
Code:
'use_page_numbers' => TRUE,
'first_link' => FALSE,
'first_tag_open' => FALSE,
'first_tag_close' => FALSE,
'last_link' => FALSE,
'last_tag_open' => FALSE,
'last_tag_close' => FALSE,
'next_link' => 'next',
'next_tag_open' => '<li>',
'next_tag_close' => '</li>',
'prev_link' => 'previous',
'prev_tag_open' => '<li>',
'prev_tag_close' => '</li>',
'cur_tag_open' => '<li class="active">',
'cur_tag_close' => '</li>',
'num_tag_open' => '<li>',
'num_tag_close' => '</li>'

When I on the third page (list/3, for example), my previous link is list/2 (is correct). When I on the second page (list/2), my first link is list (is correct), but previous link is list/1

How I can change it behaviour? I can not find anything about it in manual


Pagination: Previous link on the second page shall not display page number in link - El Forum - 10-31-2013

[eluser]InsiteFX[/eluser]
You need to show your pagination code the config is not your problem.



Pagination: Previous link on the second page shall not display page number in link - El Forum - 10-31-2013

[eluser]indapublic[/eluser]
Code:
private function __pagination($config) {
        $pagination_config = array(
            'base_url' => $myurl,
            'uri_segment' => $this->uri->total_segments(),
            'total_rows' => $config['total_rows'],
            'per_page' => $config['per_page'],
            'use_page_numbers' => TRUE,
            'page_query_string' => FALSE,
            'num_links' => 2,
            'query_string_segment' => 'page',
            'display_pages' => TRUE,
            'full_tag_open' => '<span class="label">Pages:</span><ul>',
            'full_tag_close' => '</ul>',
            'first_link' => FALSE,
            'first_tag_open' => FALSE,
            'first_tag_close' => FALSE,
            'last_link' => FALSE,
            'last_tag_open' => FALSE,
            'last_tag_close' => FALSE,
            'next_link' => '<span>next</span>&nbsp;→',
            'next_tag_open' => '<li class="arrow">',
            'next_tag_close' => '</li>',
            'prev_link' => '<span>←&nbsp;previous</span>',
            'prev_tag_open' => '<li class="arrow">',
            'prev_tag_close' => '</li>',
            'cur_tag_open' => '<li class="active"><span>',
            'cur_tag_close' => '</span></li>',
            'num_tag_open' => '<li>',
            'num_tag_close' => '</li>'
        );
        $this->load->library('pagination');
        $this->pagination->initialize($pagination_config);
        return $this->pagination->create_links();
    }



Pagination: Previous link on the second page shall not display page number in link - El Forum - 10-31-2013

[eluser]InsiteFX[/eluser]
Watch these videos:

http://www.weblee.co.uk/2009/06/06/codeigniter-pagination-part-1/