Yes that is a perfectly acceptable place for that. For example I just completed a project where the site has a franchise selector that shows up on every page and so I put it in the main.php layout file and works perfectly.
Thanks for your input. I have this working fine now.
Now I need to set a session variable for “selectedSchoolYear” so if a user changes school years, they can view data from that year instead. I would normally use jquery/ajax to do this, but don’t know the Yii2 way. There is not much documentation on jquery/ajax integration yet, any pointers?
Edit: I also wish to reload the current page so it will use the updated session information. I
So I’d definitely go the Javascritp/ajax route. You can do a quick update of some data in the browser and on the server set the session information so that for subsequent page loads the session data will have the correct information.