I have separated my template for CodeIgniter 4 in to different parts like header ,footer & sidebar. I can include them in main view like
<?= $this->include('layouts/header') ?>
but I can't send the data to this layouts, I try following syntax as like sending data to view
<?= $this->include('layouts/header',['test'=>'hello']) ?>
but when I save and check that variable in layouts/header.php as <?=$test?>
It gives error
ErrorException
Undefined variable: test