pug-php/ci-pug-engine

Code Igniter 4 support

anurat opened this issue · 4 comments

Hi, is there a support for code igniter 4?
I tried to install but it didn't seem to work.

Thanks for the ping, please try version 2.1.0, it should support CI 4.

Thank you so much for the CI 4 support.

I tried version 2.1.0 and it works with a basic pug file.
However, CI4 now has layout https://codeigniter.com/user_guide/outgoing/view_layouts.html?highlight=layout

So most of the views now look like this.

<?= $this->extend('my_layout') ?>

<?= $this->section('content') ?>
<div id="article">
    <div>
    </div>
</div>
<?= $this->endSection() ?>

I then tried to change to pug (which still doesn't work)

- $this->extend('my_layout')

- $this->section('content')
div#article
    div
- $this->endSection()

Any plan to support layouts as well?
Best Regards,

Pug has its own layout/extend (using block instead of section): https://github.com/phug-php/website/blob/master/doc/en/language-reference.md#template-inheritance

So you get exactly the same feature but with a less verbose syntax and cleanest indentation:

extends my_layout

block content
    div#article
        div

I'm not sure to get what would be the benefit of using CodeIgniter layout system and pug views simultaneously. Are you trying to get pug views using PHP layouts?

I haven't thought about that! I guess that works as well.

Thanks for pointing this out.