Making data available in ALL views |
I am attempting to make some data available in all view files. This information is displayed in the page masthead and sidebar menu. I know I could pull the data in each and every single controller, but that is tedious and really not efficient. I would like to pull it at some global point and have it available in the view.
The key is I don't want to have to modify all the controllers to pass the data to the view (or remember to pass in the future). How can I set a variable that is available in a view in say the base controller? What I have so far (in the base controller): PHP Code: class BaseController extends Controller PHP Code: <?= $siteInfo ?> I have confirmed that $siteInfo has data before you get to the view, but in the view I get: "Undefined variable $siteInfo" Feels like I am missing something simple here... help! |
Welcome Guest, Not a member yet? Register Sign In |