Welcome Guest, Not a member yet? Register   Sign In
View Component
#2

(This post was last modified: 10-22-2022, 09:35 AM by captain-sensible. Edit Reason: forgot to add some points )

if you use the approach of "layout" in your views , then you can create for want of a better word , chunks of html which can be inserted into a single main web page

So in my case my view "layout" contains the header(with links to css , bootstrap etc ) , main middle section where different content is inserted and footer(also containing jquery ) in the middle it has
Code:
<?= $this->renderSection('content') ?>


each different "chunk" of html will be in the form :

Code:
<?= $this->extend('layout') ?>

<?= $this->section('content') ?>
<!-- you can even inject content into chunks of html that will extend tyhe main lay out using line below-->

<?= $this->include('carousel') ?>

<!-- in the above i inject a chunk which uses bootstrap carousel-->


<!-- all html content here-->
<?= $this->endSection() ?>
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply


Messages In This Thread
View Component - by SubrataJ - 10-22-2022, 04:51 AM
RE: View Component - by captain-sensible - 10-22-2022, 09:32 AM
RE: View Component - by kenjis - 10-22-2022, 06:56 PM
RE: View Component - by SubrataJ - 10-22-2022, 08:23 PM
RE: View Component - by kilishan - 10-24-2022, 06:52 AM
RE: View Component - by SubrataJ - 10-25-2022, 06:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB