Welcome Guest, Not a member yet? Register   Sign In
How to use public variables from controller in views in CI 4
#4

(This post was last modified: 12-29-2020, 07:33 PM by MIS.)

PHP Code:
$view = \Config\Services::renderer();
$data = [
        'blog_title'  => 'My Blog Title',
        'blog_heading' => 'My Blog Heading'
];

echo 
$view ->setData($data)
            ->render('blog_template'); 

https://codeigniter.com/user_guide/outgo...ta#setData
https://codeigniter.com/user_guide/outgo...ht=setdata
Reply


Messages In This Thread
RE: How to use public variables from controller in views in CI 4 - by MIS - 12-29-2020, 07:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB