创建控制器基类(部分)
由于我的 @html.render
操作使我的开发和产品服务器崩溃,我必须使用 partials(crap)。
我尝试创建 public 部分控制器{}
类,以便我可以为所有视图设置所需的数据,但我没有运气(一切都崩溃了)。
我来自 LAMP cakePHP 背景,确实需要简单性。
我需要知道如何创建部分基本控制器(不会覆盖常规基本控制器)以及如何从类访问多个模型。
谢谢你!
Since my @html.render
action crashes my dev and prod servers i have to use partials(crap).
I tried creating public partial controller{}
class so i can set needed data for all my views but i am having no luck (everything breaks).
I am coming from LAMP cakePHP background and really need simplicity.
I need to know how to create a partial base controller(that doesnt override the regular base controller) and how to access multiple models from the class.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
即只是从新的基本控制器类派生。
不过,我建议您在这里询问为什么您的 RenderPartial“崩溃” - 因为它对您来说可能是更好的方法,而且它显然不应该崩溃。
I.e. just derive from your new base controller class.
However I'd suggest you to ask here why your RenderPartial "crashes" - since it can be a better way for you, and it obviously shouldn't crash.
创建基本控制器的更好方法,
使其余控制器遵循常规约定
better way to create base controller
that way the rest of controllers follow regular convention