I have a doubt about templates using twig, my problem is the following, I have a page called index.html.twig, which extends from base.html.twig. In index.html.twig there are two include blocks, (one is for the upper menu bar; a navbar and the other one corresponds to the footer) My navbar contains the following options for anonymous users,
--Login--Register--Contact--
Now, if I sign in, I wanted to load a different navbar instead of the previous one, for example
--You're signed as Blablabla-- Edit profile -- Exit --
How can I accomplish this? I mean, to include different blocks based on a session. Do I have to check in the view if the user is logged in? Or do I have to check in the controller if the user has session and then load a different index.html.twig(one for logged in users.) In relation with the last option, I can create an index.html.twig, and an indexLoggedIn.html.twig, and in the controller I can check, if the user is logged in I render indexLoggedIn, otherwise I load index.html.twig. I used the FOSUserBundle for user management. Thanks!