Welcome Guest, Not a member yet? Register   Sign In
How to output the variables to all the views files
#1

(This post was last modified: 11-16-2016, 09:39 AM by startbbs.)

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. 
Q&A for Codeigniter
StartBBS--open-source, light weight forum software.
Best VPS:Digital Ocean
Reply
#2

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
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

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

</sarcasm>
Reply
#4

(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.
Q&A for Codeigniter
StartBBS--open-source, light weight forum software.
Best VPS:Digital Ocean
Reply




Theme © iAndrew 2016 - Forum software by © MyBB