Welcome Guest, Not a member yet? Register   Sign In
How to use LayoutView with parser?
#10

you should create layout file: layout.php
Code:
<?=view('app/view/header'); ?>
<?= $this->renderSection('main') ?>
<?=view('app/view/footer'); ?>

file to view when call from route : content.php
Code:
<?= $this->extend('app/view/layout) ?>
<?= $this->section('main') ?>
// put your content here to display ,   $data1 , $data2 as variable here
<?= $this->endSection() ?>

controller (example):
Code:
function your_function(){
$data1 = [];
$data2 = [];
return view('app/view/content',[ 'data1' => $data1,'data2' => $data2]);
}

routes.php file: ( example Home class, route /content)
$routes->get('content', 'Home::your_function');
Reply


Messages In This Thread
How to use LayoutView with parser? - by aleckyann - 08-14-2020, 10:40 AM
RE: How to use LayoutView with parser? - by ikesela - 02-10-2022, 09:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB