CodeIgniter Forums
How to output the variables to all the views files - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forum-31.html)
+--- Thread: How to output the variables to all the views files (/thread-66654.html)



How to output the variables to all the views files - startbbs - 11-16-2016

output the variables to all the views files, I use "$this->load->vars($data)" in old version CI.
how about in CI4?

I Query data from database, then the data can be called in any of view files. 


RE: How to output the variables to all the views files - InsiteFX - 11-16-2016

Not sure if this what you mean but it will persist the data.


PHP Code:
echo view('blogview'$data, ['saveData' => true]); 

Additionally, if you would like the default functionality of the view method to be that it does save the data between calls, you can set $saveData to true in application/Config/Views.php.

See Also:

View Renderer


RE: How to output the variables to all the views files - Narf - 11-16-2016

If you DON'T want help, write all of your text in bolds.

</sarcasm>


RE: How to output the variables to all the views files - startbbs - 11-16-2016

(11-16-2016, 09:56 AM)InsiteFX Wrote: Not sure if this what you mean but it will persist the data.


PHP Code:
echo view('blogview'$data, ['saveData' => true]); 

Additionally, if you would like the default functionality of the view method to be that it does save the data between calls, you can set $saveData to true in application/Config/Views.php.

See Also:

View Renderer
THanks, InsiteFX. it was solved.