CodeIgniter Forums
How to use LayoutView with parser? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How to use LayoutView with parser? (/showthread.php?tid=77311)

Pages: 1 2


RE: How to use LayoutView with parser? - Kenn38 - 02-10-2022

As the Codeigniter 4 manual says, you can use the following:
PHP Code:
    $data = [
            'blog_title'  => 'My Blog Title',
            'blog_heading' => 'My Blog Heading'
    ];
    
    
echo $parser->setData($data)
                ->render('blog_template'); 



RE: How to use LayoutView with parser? - karthik_code - 05-08-2022

It is important feature missing in CodeIgniter.
But here is the working solution
PHP Code:
$data['title'] = 'CI4 Tutorial';        
$view view('welcome_page');
echo 
$parser->setData($data)->renderString($view);