开发者

Render view script inside iframe in zend framework

I want the view script of one of my controller actions to be r开发者_高级运维endered inside an iframe in my zend framework application. how it is possible?


Have a separate action (maybe controller too ...) for the view you want to render inside the iframe ( you'll probably want to play in this action with $this->_helper->layout()->disableLayout(); or maybe change the layout ... depends on what you're trying to achieve ) , then in you're view you want to show the iframe do

<iframe src="you're iframe action uri">
    <p>Your browser does not support iframes.</p>
</iframe>


same as it is in the browser,

set the iframe src to /controllers/view/,

Think if an iframe as a browser in the page with advanced JS controls.


  1. Set the proper Doctype supporting iframes
  2. Then,

In your view:

<iframe src="<?= $this->url(array(
    'module'=>'yourmodule',
    'controller'=>'yourcontroller',
    'action'=>'youraction'),
    'default', true); ?>  ">

    <?= $this->render('/path/to/your/view/youraction.phtml'); ?>
</iframe>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜