2
After logging in via controller LOGIN, a Session is created with the ID of that user in the system, from that ID can give a "fetch" with all your information, the big problem is that when you log in a navbar is at the top of the site, ex:
That navbar is in the archive header.phtml, which is not a "view", but is called when a view is instantiated, to show the navbar of the user on all pages I have to pass a array with that user’s data for all controllers through the main controller in which all extend, so they will "play" this information on header.phtml, what would be the best way to pass logged user information to all controllers and display it in views
Do you want to know in which format you pass the data or something else? I really didn’t understand your need.
– Erlon Charles
You could go through Session as well and set the data in your controller leading
– Erlon Charles
Which framework you are using?
– Erlon Charles
I’m doing it by hand, I thought I’d pass a Session with an array, but if the data were updated? would it be static.
– Thiago
Inserts a rule on updating data where if the logged-in user updates their own information the session is also updated
– Erlon Charles
I get it, can you shed some light on what that rule would be? would it be something like Affectrows? and how would I pass on that information? let’s say that the user updates their data in the 'My Account' controller, as I would 'Warn' another controller?
– Thiago
in the method you perform the user update you have to do a
if($_SESSION["Usuario"]["id"]){$_SESSION["Usuario"]["username"] = $_POST["Usuario"]["username"]}
would be something along those lines, but without seeing their codes it gets very complicated to help more.– Erlon Charles
For now I will indicate your question to close as "it is not clear what you are asking", but if you edit it and make more evident your need I remove my vote.
– Erlon Charles
Okay, I think that’s enough, thanks for the help!
– Thiago