The tabs on my web app are dynamic depending on whether the user is logged in or not and what permissions they have.
For example, a guest user (not logged in) might see:
[color="#0000FF"][font="Verdana"]Home | Services | Login[/font][/color]
A logged-in, basic user might see:
[color="#0000FF"][font="Verdana"]Home | Tools | Upgrade | Logout[/font][/color]
And a logged-in, premium user might see:
[color="#0000FF"][font="Verdana"]Home | Tools | Premium Tools | Logout[/font][/color]
My question is where to put the code to set the tabs. I’ve considered:
-
embed it directly in views/layouts/main.php the way the vanilla-Yii dynamically displays Login or Logout
-
create a component that constructs the HTML and have main.php call the controller
-
create separate files for each option and have main.php include the appropriate file (similar to how column1.php or column2.php get included)
-
other ideas?
The PHP code is easy to do, but I’m still pretty new to Yii and want to follow Yii conventions.
Suggestions?