User menu and best practice


In my application, I will have three different menus depending on the user rights. What’s the best practice to display the menu in the template (the Yii way) ?

  • Portlet ? 3 different ?

  • One menu in the template with tests on user rights ?




I think if the user roles are fundamentally different, modules would be the best approach.

Otherwise, if it limits to rights, I’d say test on user rights on the menu level, or if it limits to a small handful of menu items, on the item level…

Disclaimer: I’m a newbie so don’t take anything I say for granted :slight_smile:

Thank you :)

A last question.

I see in the blog demo documentation that a portlet is created for all side/top/bottom fragments in the page.

Should I use a portlet for my menu even if there is no role rules ?

Is it a good idea to use portlet to render static elements or should I make fragments (using renderPartial) ?

I am actually not understanding the interest of portlet, I think xD



I believe if it’s reusable through views, why not? Otherwise, you’d end up specifying the same menu here and there.

I’ve just noticed however that this page doesn’t appear in the 1.1 blog tutorial. Maybe someone more experience can explain why. Is there a better alternative or new widget in 1.1?