03-12-2019, 11:12 AM
(This post was last modified: 03-12-2019, 02:12 PM by eincandela.
Edit Reason: typo
)
Hello,
i'm a little suprised by the way the layout system in CI4 works (or maybe i didn't understand it correctly)
As far as i get it from the docs, the view file must declare the layout it is inserted into by:
<?= $this->extend('default') ?>
<?= $this->section('content') ?>
<h1>Hello World!</h1>
<?= $this->endSection() ?>
But why should it be the responsibility of the view file to know that info?
If i go the CI4 approach and want to reuse a page into another layout i have to duplicate it (or tweak it by passing a view name into a variable) + if i want to change the layout for a bunch of page, i have to modify all of them.
I can find my peace with that by tweaking it a little, but i don't see the pros of that design choice ? Any opinion welcomed
Emmanuel
i'm a little suprised by the way the layout system in CI4 works (or maybe i didn't understand it correctly)
As far as i get it from the docs, the view file must declare the layout it is inserted into by:
<?= $this->extend('default') ?>
<?= $this->section('content') ?>
<h1>Hello World!</h1>
<?= $this->endSection() ?>
But why should it be the responsibility of the view file to know that info?
If i go the CI4 approach and want to reuse a page into another layout i have to duplicate it (or tweak it by passing a view name into a variable) + if i want to change the layout for a bunch of page, i have to modify all of them.
I can find my peace with that by tweaking it a little, but i don't see the pros of that design choice ? Any opinion welcomed

Emmanuel