-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
$pager->links() not working inside view layouts #3164
Comments
I can't really recreate it. Can you give us any more details like CodeIgniter version? Maybe a quick example of how to recreate it? |
Right, I am using codeigniter version 4.0.3 |
the view instance in CodeIgniter\Pager\Pager knows if it's rendering inside a view layout and the view render method does not work inside view layouts (from the docs, include() is the recommended method). I was thinking to have a simple |
Correct me if I'm wrong. Shouldn't this be not a problem? I mean, using CodeIgniter4/system/View/View.php Line 510 in 6c7c36d
I don't know if it is a typo or not. <!-- TEMPLATE -->
<?= $this->extend('layout') ?>
<?= $this->section('content') ?>
<?= pager->links() ?> // shouldn't this be <?= $pager->links() ?>
<?= $this->endSection() ?> |
I also see no difference between those two, except for
Looks like a typo to me. |
Okay... I'm closing this, since it doesn't seem to be a bug, but feel free to continue the conversation - especially if you can provide more examples. Thanks. |
Oh mehn. Yes, it is a typo |
The pager does not render the view in view layouts obviously because displayLinks() method uses render() and not include() method.
SUGGESTION
My workaround would be to use the layout property of $this->view to determine whether to use the right render method.
At the moment I have extended the service and overridden the method to use include because I'm working with layouts in the whole project.
The text was updated successfully, but these errors were encountered: