我有一个客户端html和javascript应用程序,它使用RESTneneneba API,返回JSON。现在我有了登录时的主页,将配置文件信息存储在javascript对象中。然后,系统中的所有其他页面都显示在iFrame中,这样他们就可以访问父页面中的JSON数据,而无需再调用ajax。
由于未来的需求,我需要将应用程序移动到Zend Framework,并且我不确定如何呈现包含iframe的单个视图,然后将所有其他视图加载到其中,而不是实例化新的布局模板并仅加载视图。
我对Zend Framework有足够的了解,所以我并不是在寻找基本的Zend Framework帮助,只是一个疯狂的用例,为什么iframe。。。我不知道,客户要求。
提前感谢:)
-
将默认布局设置为iframes中使用的布局(即最小装饰)
; application.ini resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.layout.layout = "iframe" ; refers to application/layouts/scripts/iframe.phtml
-
在主页面控制器中,将布局设置为完整页面版本
public function indexAction() { $this->_helper->layout->setLayout('full'); // refers to application/layouts/scripts/full.phtml }
-
在整个页面布局中,创建您的iframe并将其命名为
<iframe src="" name="content" height="100" width="200">You need a Frames Capable browser to view this content.</iframe>
-
在您的主页视图中,直接链接到iframe 中打开
<a href="<?php echo $this->url(array( 'action' => 'some-action' )) ?>" target="content">Click me</a>