Welcome Guest, Not a member yet? Register   Sign In
Pagination with URI segment
#1

(This post was last modified: 08-14-2022, 03:36 AM by mohs3n.)

Hello all
I am writing a simple blog application and want to have a pagination like the following: https://sampleblog.local/posts/page/2
Default pagination is like: https://sampleblog.local/posts?page=2

I have read the documentation : https://codeigniter4.github.io/CodeIgnit...t-for-page
But still cannot implement it.
I would appreciate it if anyone can provide a sample code.

My controller:
PHP Code:
        $data['articles'] = $posts->orderBy('id','DESC')
                            ->where("type = 'article' AND status = 'publish'")
                            ->paginate(5);
        $data['pager'] = $posts->pager
Reply


Messages In This Thread
Pagination with URI segment - by mohs3n - 08-14-2022, 03:35 AM
RE: Pagination with URI segment - by ozornick - 08-14-2022, 12:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB