Basic App

An open source simple CMS based on CodeIgniter 4

Theming CodeIgniter 4 pager in Bootstrap 4 style

CodeIgniter 4 for the page navigation block generates HTML code non-compatible with Bootstrap 4 CSS framework. We offer you to use a ready-made solution to design a CodeIgniter 4 pager in Bootstrap 4 style.

Installation Instructions:

  1. Add a small library contains a template via Composer.
composer require "basic-app/bootstrap4:dev-master"
  1. Setup the template in the autoloader config: "/Config/Autoload.php".
$psr4 = [
    ...
    'BasicApp\Bootstrap4' => dirname(dirname(COMPOSER_PATH)) . '/vendor/basic-app/bootstrap4'
];
  1. Setup the template in the pager config: "/Config/Pager.php".
public $templates = [
    ...
    'bootstrap4' => 'BasicApp\Bootstrap4\Views\pager'
];

Additional Settings:

You can specify how many links you need to create on each side of the active link. Add a public variable $surroundCount in the pager config: "/Config/Pager.php".

public $surroundCount = 3;

public $templates = [
    ...
];

Example of Use:

echo $pager->links('default', 'bootstrap4');

Posted on 2019-01-25