Answers for "codeigniter 4 pagination style"

PHP
0

pagination in codeigniter with example

// Controller End
$config = array();
$config["base_url"] = base_url() . "index.php/StudentPagination_Controller/index";
$config["total_rows"] = $this->StudentPagination_Model->get_count();
$config["per_page"] = 10;
$config["uri_segment"] = 3;

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


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

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

$data['student'] = $this->StudentPagination_Model->get_students($config["per_page"], $page);

$this->load->view('pagination', $data);
Posted by: Guest on April-06-2021
0

codeigniter pagination example

<?php

namespace AppControllers;

use CodeIgniterController;

class UserController extends Controller
{
    public function index()
    {
        $model = new AppModelsUserModel();

        $data = [
            'users' => $model->paginate(10),
            'pager' => $model->pager,
        ];

        echo view('users/index', $data);
    }
}
Posted by: Guest on January-18-2022

Browse Popular Code Answers by Language