[英]Inserting index.phtml view from side controller in the main index.phtml
I have Entry controller with index action that lists all entries, and of course views/scripts/index.phtml. 我有带有索引操作的Entry控制器,其中列出了所有条目,当然还有views / scripts / index.phtml。 I also have the main page index/index.phtml.
我也有主页index / index.phtml。 How can I include entry/index.phtml in index/index.phtml so I can see the results of entries as part of the structure of the home page?
如何在entry / index.phtml中包含entry / index.phtml,以便可以将条目的结果作为主页结构的一部分看到?
try something like this towards the end of your indexAction() in the index controller: 在索引控制器的indexAction()末尾尝试类似这样的操作:
$this->_helper->actionStack('index', 'entry');
Alternatively, I think you may be able to to do think in the index/index.phtml script: 另外,我认为您可以在index / index.phtml脚本中进行思考:
<?php echo $this->action('index', 'entry');?>
First example is the actionStack action helper the second is the action view helper 第一个示例是actionStack动作帮助器 ,第二个是动作视图帮助器
Good luck! 祝好运!
You may create view helper for this, in which you: 您可以为此创建视图帮助器,其中:
$this->view->render('pathoto/scriptname.phtml')
). $this->view->render('pathoto/scriptname.phtml')
)。 You may also add script path using addScriptPath()
. addScriptPath()
添加脚本路径。 Then use this helper in those two scripts you need. 然后在所需的这两个脚本中使用此帮助程序。
If AJAX it the root of your needs, take a look at actionContext
and ajaxContext
action helpers. 如果AJAX是您需要的根源,请查看
actionContext
和ajaxContext
操作帮助器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.