CodeIgniter Forums
How to renderSection work multiple time in CodeIgniter 4? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: How to renderSection work multiple time in CodeIgniter 4? (/showthread.php?tid=80690)



How to renderSection work multiple time in CodeIgniter 4? - trytest - 12-03-2021

Code:
I am trying to render my section twice on the same page. But, the second time, it's returning NULL

<?= $this->extend('admin/layout') ?>
<?= $this->section('title') ?>
    Page Title
<?= $this->endSection('title') ?>
<?= $this->section('content') ?>
 
  <div class="content-wrapper">
    <div class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1 class="m-0"><?=$this->renderSection('title')?></h1>
        </div>
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="javascript:void">Home</a></li>
            <li class="breadcrumb-item active">**<?=$this->renderSection('title')."<<<<< Not print here"?>**</li>
          </ol>
        </div>
      </div>
    </div>
    </div>
  </div>



RE: How to renderSection work multiple time in CodeIgniter 4? - InsiteFX - 12-03-2021

You need to add the endSection after each section displayed.