Twig integration in CI4 |
(03-20-2023, 01:10 AM)kenjis Wrote: See https://github.com/kenjis/codeigniter-ss-twig Hello, Can you please give an exemple using base_url() in a twig template like we do in a basic codeigniter view href="<?= base_url('admin/settings') ?>" All i found was , in controller $this->twig->addGlobal('base_url', base_url() ); in template href="{{ base_url }}/admin/settings" Thanks Code: href="{{ base_url('admin/settings') }}"
I think if you use Twig, the debug comments will not be added.
And these are not added in production environment. If you don't need them in development environment. PHP Code: view('foo/bar', $data, ['debug' => false]); (04-08-2023, 04:59 PM)kenjis Wrote: I think if you use Twig, the debug comments will not be added. I use twig and debug comments are displayed! To render view, i use $this->twig->render PHP Code: return $this->twig->render('bookmark/index',$data, ['debug' => false]); And what about pagination ? code of app\Views\Pager\pagination.twig is diplayed between <!-- DEBUG-VIEW START ... and <!-- DEBUG-VIEW ENDED
1. The DEBUG-VIEW comment like "<!-- DEBUG-VIEW START 1 APPPATH/Views/Pager/default_full.php -->" is output by CI4's View class.
2. If you use Pagination in CI4 with Twig, the DEBUG-VIEW comment will be output in the output HTML. 3. To disable it, set the CI_DEBUG constant to false. (04-12-2023, 05:26 AM)kenjis Wrote: 1. The DEBUG-VIEW comment like "<!-- DEBUG-VIEW START 1 APPPATH/Views/Pager/default_full.php -->" is output by CI4's View class. Ok, thanks for the explanation, that's what i had found using {{ dump(pager.links) }} to understand But i can't fix it! I put CI_DEBUG = false in .ENV but it does not work for twig Even for classic codeigniter view mode (this below is part of the html flow) : Code: <!-- DEBUG-VIEW START 1 APPPATH/Views/pagers/default_full.php --> But then, using twig, the flow is still not good, code of default_full.twig is displayed as if htmlentities() was used Code: [..] In app\Config\Pager.php PHP Code: public array $templates = [ PHP Code: public function initController( PHP Code: {% extends "default.twig" %} PHP Code: <main id="content" class="container" role="main"> (04-14-2023, 02:43 AM)foxbille Wrote: I put CI_DEBUG = false in .ENV but it does not work for twig The CI_DEBUG is a PHP constant, not an environment variable. Yes, to set CI_ENVIRONMENT to production makes it false. |
Welcome Guest, Not a member yet? Register Sign In |