Zend Framework 加载视图而不重新加载布局模板
我需要加载一个配置文件布局,然后将所有配置文件视图加载到该布局中,而无需重新加载布局,以便我可以在客户端浏览器中缓存一个大的 json 对象,以允许数据在后续视图中可用,无需为我的个人资料控制器中的每个视图执行新的 HTTP 请求。
是否可以加载布局模板,然后通过禁用布局模板将视图加载到其中,以便布局模板永远不会重新加载,仅加载其中的视图?
另一种选择是在布局内放置一个 iframe,然后通过禁用其布局将视图加载到 iframe 中,以便仅渲染视图。
只需知道这是否可行以及最好的选择是什么。
提前致谢 :)
I need to load a profile layout and then have all of the profile views load into that layout without re-loading the layout, so that I can cache a big json object in the clients browser, to allow for data to be available on subsequent views, without having to do a new HTTP request for every view in my profile controller.
Is it possible to load the layout template and then load views into it, by disabling their layout template, so that the layout template never re-loads, only the view within?
Another option would be to have an iframe inside of a layout and then load the views into the iframe, by disabling their layouts, so that just the view is rendered.
Just need to know if this is possible and what the best option would be.
Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您不需要布局的视图中尝试:
这应该会阻止显示布局。
如果出于某种原因,您希望多次调用同一个控制器的相同操作,但加载布局一次(必须是组织自己的更好方法),但您可以随时尝试:
我会尝试给出一个更好的示例:
假设您有一个具有 3 个视图的控制器 foo:索引、联系人、新闻。
因此需要布局的视图都有一个。那些不这样做的人。除非您说的是布局,但实际上正在考虑其他事情,那么 Zend_View_Helpers_Layout 您将不必发布一些代码来帮助我们帮助您!
In the views where you do not want a layout try:
This should prevent the layout from being shown.
If, for some reason, you want the same action from the same controller called many times but load the layout once (must be a better way to organise yourself) but you could always try:
I'll try to give a better example:
Lets say you have a controller foo with 3 views: index, contact, news.
So the views that need a layout have one. The ones that do not do not. Unless you are saying layout but really thinking of something else then Zend_View_Helpers_Layout you will have t post some code to help us help you!