Closed mwauramuchiri closed 4 years ago
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 Sorry, to recreate what exactly?
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 if else
that will do ->include($template)
if the pager is being rendered inside a view layout.
Correct me if I'm wrong. Shouldn't this be not a problem? I mean, using include
will just call render
under the hood, so there isn't must difference between the two.
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 $saveData
default value.
<?= pager->links() ?> // shouldn't this be <?= $pager->links() ?>
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.