You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a website where the header (/app/views/layout/header.php) is different for logged in users and not logged in users, how would you implement that?
The difference is one header for anonymous users that contains a Sign In button and a drop down menu of other account options and one that contains Log Out button instead for logged in users.
I can think of 2 possible solutions:
Pass the data to the view through the $data[] associative array. (ex: $data['loggedin] = 0 or 1 for true and false). Then add the logic (an if statement) within /app/views/layout/header.php to render the right content. Is it appropriate to put if statement logic within a view?
Have the Model call a different view if user is logged in (for example: /app/views/layout/header.php and /app/views/layout/user_header.php).
Any thoughts would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
Hey,
It's been a while since i last checked the project, but i took a quick look and I think the second solution would be better for modularity .
You already have $loggedUser variable in /app/core/Controller.php so you can just modify the view function to include different header in case the user is logged in.
If you have a website where the header (/app/views/layout/header.php) is different for logged in users and not logged in users, how would you implement that?
The difference is one header for anonymous users that contains a Sign In button and a drop down menu of other account options and one that contains Log Out button instead for logged in users.
I can think of 2 possible solutions:
Any thoughts would be greatly appreciated.
The text was updated successfully, but these errors were encountered: