• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to output the variables to all the views files

#1
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 the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

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

</sarcasm>
Reply

#4
(11-16-2016, 10: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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.