CakePHP 视图共享 w/ ACL(因此不需要重复的视图文件)
基本上我想做的是,我只想在管理员登录时在项目旁边显示 CRUD 控件,而不是为管理和用户界面创建 2 个独特的视图。
现在我正在做的方式是检查身份验证会话状态并回显控制器链接(如果身份验证会话已激活)。
但我想知道是否还有任何其他(可能更好)的方法有人可能想建议。
Basically all I want to do is, instead of creating 2 unique views for the admin and user interface, I only want to display the CRUD controls next to the items when the admin IS logged in.
Now the way I am currently doing it is checking the Auth session status and echoing out the controller links IF the Auth session has be activated..
But I wanted to know if there are any other (maybe better) approaches anyone might like to suggest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我完全理解你的问题。
正如您所意识到的,有几种方法可以实现这一点,各有利弊。
如果您想显示禁用的控件,那么您需要执行类似您已有操作的操作。
我想我更倾向于分开观点。这种方法将允许您单独设置查看个人资料和编辑个人资料视图的样式,也许可以更好地反映公共和管理风格。当然,您仍然需要检查身份验证。
I understood your question perfectly.
There are, as you realise, several approaches to this all with their pros and cons.
If you want to show the disabled controls, then you'll need to do something like what you already have.
I think I'd be more inclined to separate the views. This approach will allow you to style the view profile and edit profile views individually, perhaps better reflecting public and admin styles. You'll still need to check the Auth, of course.