CodeIgniter Forums
Pager->links customization - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Pager->links customization (/showthread.php?tid=86909)



Pager->links customization - humbucker - 02-25-2023

Hello,
I'm using the pager->links function to display page numbers & links on my search results page.
However, this function also display extra text links such as "Next" & "Last", that I would like to hide. (I would like to keep only page numbers links)
As there is no CSS class generated to hide them, is there another way to achieve this ?
Thank you!


RE: Pager->links customization - kenjis - 02-25-2023

See https://codeigniter4.github.io/CodeIgniter4/libraries/pagination.html#customizing-the-links


RE: Pager->links customization - humbucker - 02-26-2023

Hello Kenjis,

I've tried creating a custom pagination view, using exactly the examples given in the documentation, but I end up with only 1 page result instead of more...
I'm using CI 4.2.4, could this be the reason ?

Thank you


RE: Pager->links customization - kenjis - 02-26-2023

As far as I know, there is no bug around pagination recently.
So v4.2.x should work.


RE: Pager->links customization - InsiteFX - 02-26-2023

Works fine for me with Custom Templates. php 8 and CodeIgniter 4.3.2.


RE: Pager->links customization - humbucker - 02-26-2023

In which file could I check the actual view code executed by the native $page->links() function ?
Maybe I could spot my mistake, by comparing the 2 codes ?

Thank you


RE: Pager->links customization - kenjis - 02-26-2023

You need to check only two files.

Config:
PHP Code:
<?php

namespace Config;

use 
CodeIgniter\Config\BaseConfig;

class 
Pager extends BaseConfig
{
    public $templates = [
        'default_full'  => 'CodeIgniter\Pager\Views\default_full',
        'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
        'front_full'    => 'App\Views\Pagers\foundation_full',
    ];

    // ...


View:
PHP Code:
<?= $pager->links('group1''front_full'?>