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 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?
2 Answers
1
votes
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!
0
votes
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 usingaddScriptPath()
.
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.