Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: $this->cachePage($n) - Pagination Problem #6584

Closed
mbnl opened this issue Sep 24, 2022 · 3 comments
Closed

Bug: $this->cachePage($n) - Pagination Problem #6584

mbnl opened this issue Sep 24, 2022 · 3 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@mbnl
Copy link

mbnl commented Sep 24, 2022

PHP Version

8.0

CodeIgniter4 Version

4.2.6

CodeIgniter4 Installation Method

Manual (zip or tar.gz)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

fpm-fcgi

Database

Mysql 5.6

What happened?

First of all, his English is not good.

I have a blog page and I am using pagination.

When I use the $this-cachePage() function on my blog page, it shows the 1st page that is cached when switching between pages, so it doesn't switch to other pages. How can I solve this?

Steps to Reproduce

public function index()
    {
        $this->cachePage(60);

        $pageImage = model('PageImages')->image('blog', $this->cms);

        $blogQuery = model('Blogs')->orderBy('tarih','DESC');
        $list = $blogQuery->paginate(1);
        $pager = $blogQuery->pager;


        $this->setPageTitle($this->cms->lang('blog'));
        return view('blog',compact('pageImage','list','pager'));
    }

Expected Output

on which page it should be cached

Anything else?

No response

@mbnl mbnl added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 24, 2022
@lonnieezell
Copy link
Member

Cache page will cache the entire page and doesn't work well with dynamic pages like that. It doesn't currently take Query vars into account.

I would do the caching within the controller just so that it doesn't have to hit the database at all. Then make sure you clear the cache whenever you publish a new blog post.

@mbnl
Copy link
Author

mbnl commented Sep 24, 2022

Cache page will cache the entire page and doesn't work well with dynamic pages like that. It doesn't currently take Query vars into account.

I would do the caching within the controller just so that it doesn't have to hit the database at all. Then make sure you clear the cache whenever you publish a new blog post.

thank you for your response.

@mbnl mbnl closed this as completed Sep 24, 2022
@kenjis
Copy link
Member

kenjis commented Sep 24, 2022

The Query String bug was fixed in the developbranch and it will be included in v4.2.7.
See #6475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

3 participants