开发者

Inserting index.phtml view from side controller in the main index.phtml

开发者 https://www.devze.com 2023-02-07 03:26 出处:网络
I have Entry controller with index action that lists all entries, and of course views/scripts/index.phtml. I also have the main page index/index.phtml. How c开发者_开发技巧an I include entry/index.pht

I have Entry controller with index action that lists all entries, and of course views/scripts/index.phtml. I also have the main page index/index.phtml. How c开发者_开发技巧an 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?


try something like this towards the end of your indexAction() in the index controller:

$this->_helper->actionStack('index', 'entry');

Alternatively, I think you may be able to to do think in the index/index.phtml script:

<?php echo $this->action('index', 'entry');?>

First example is the actionStack action helper the second is the action view helper

Good luck!


You may create view helper for this, in which you:

  • retrieve the data (e.g. from database)
  • pass the data to the view
  • render the view you need ($this->view->render('pathoto/scriptname.phtml')). You may also add script path using 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.

  • http://framework.zend.com/manual/en/zend.controller.actionhelpers.html
0

精彩评论

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

关注公众号