We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Phalcon: View Structure for Multiple Roles!!

Hi. I have a project, where users have multiple roles:

define ('GUEST',0); define ('ADMIN',1); define ('PRO',2);

Depending on the role, I want to pull a different view in some cases. I'm wondering the best way to structure the folder/files for the views.

Should each role have a folder, and I look to see if the view exists/if not go to the next role? Or do I do this with file names ->index_admin.volt, index_pro.volt?

To your taste. I would do through the folder, so for me it is more convenient. Less action extra.

If the pages are similar to each other, but the admin, for example, needs to display additional fields, then you should consider the access system and make a conclusion in the template:

{% if AUTH.isAllowController('logs', 'index') %}
    {# Show info for user #}
{% endif %}

The basis can be taken ACL

I would put as much as possible to layout files and just change layout files and maybe use blocks for any actual content which will differ.

This post is very Helpful for me thankful for sharing the great article [url=https://multipaltech.blogspot.com/]Multipal tech Blogging[/url] [url=https://multipaltech.blogspot.com/]25 Best Google Chrome Extensions in Hindi[/url] [url=https://multipaltech.blogspot.com/]What is 301 Redirect in Hindi | 301, 302 Redirect[/url] [url=https://multipaltech.blogspot.com/]Schema Markup kya hai SEO ke liye kyo Important hai? In Hindi[/url] [url=https://multipaltech.blogspot.com/]Professional blog kaise banaye? 2020 Full Guide[/url] [url=https://multipaltech.blogspot.com/]How to play PUBG After the ban in india?[/url] [url=https://multipaltech.blogspot.com/]Why do you think we Celebrate Black Friday?[/url]