Welcome Guest, Not a member yet? Register   Sign In
Do you have any tips for the best way to structure partial views?
#1

Hi,
I'm reading about renderSection(), but it seems a bit confusing for me. I don't get its workflow and how it really works. Do you have any tips or know any good tutorial about it?
Thanks.
Reply
#2

Views/parent.php
PHP Code:
<h1>Child: <?=$this->renderSection('child')?></h1> 

Views/child-a.php
PHP Code:
<?= $this->extend('parent'?>

<?= $this->section('child'?>
AAAAAAA
<?= $this->endSection() ?>

Views/child-b.php
PHP Code:
<?= $this->extend('parent'?>

<?= $this->section('child'?>
BBBBBBB
<?= $this->endSection() ?>

Now
PHP Code:
view('child-a'// <h1>Child: AAAAAAA</h1>
view('child-b'// <h1>Child: BBBBBBB</h1> 
Reply
#3

Is there something difficult to understand?

View Layouts — CodeIgniter 4.1.7 documentation
https://codeigniter4.github.io/userguide...youts.html
Reply
#4

Is
PHP Code:
<?= $this->endSection() ?> necessary? 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB