Creating Layouts and Templates in CodeIgniter — a practical guide to CodeIgniter layouts with clear examples you can reuse in real projects.
CodeIgniter Tutorial Series (16/74). Prefer one article? Read the complete CodeIgniter tutorial.
Short description
CI4 supports view layouts so header/footer stay in one place while each page fills content sections.
Layout + page
<!-- Views/layout.php -->
<html><body>
<?= $this->renderSection('content') ?>
</body></html>
<!-- Views/about.php -->
<?= $this->extend('layout') ?>
<?= $this->section('content') ?>
<h1>About</h1>
<?= $this->endSection() ?>