CI4 beta.1 - How to load view in view with layout |
I solved this by extending the core View class, added a function to render partial view.
Function renderPartial is combined from function render and renderString of the View class. I also put additional data for partial view in $options parameter. PHP Code: <?php namespace App\Core; In app\Config\Services.php, add a function to override renderer service using MyView PHP Code: public static function renderer($viewPath = null, $config = null, bool $getShared = false) Then in a view with layout, you can call a partial view like this PHP Code: <?= $this->extend('layout') ?> |
Messages In This Thread |
CI4 beta.1 - How to load view in view with layout - by pinebranch - 03-08-2019, 01:40 AM
RE: CI4 beta.1 - How to load view in view with layout - by elephpantech - 03-08-2019, 10:28 AM
RE: CI4 beta.1 - How to load view in view with layout - by pinebranch - 03-10-2019, 01:50 AM
RE: CI4 beta.1 - How to load view in view with layout - by eincandela - 03-12-2019, 10:47 AM
RE: CI4 beta.1 - How to load view in view with layout - by InsiteFX - 03-13-2019, 03:38 AM
RE: CI4 beta.1 - How to load view in view with layout - by kilishan - 03-13-2019, 09:03 PM
RE: CI4 beta.1 - How to load view in view with layout - by belial_seed - 03-25-2020, 11:11 PM
RE: CI4 beta.1 - How to load view in view with layout - by aisonet - 03-12-2021, 04:32 PM
RE: CI4 beta.1 - How to load view in view with layout - by InsiteFX - 03-12-2021, 09:41 PM
|