ZEND, rendering different view with data

六眼飞鱼酱① 提交于 2019-12-30 06:26:09

问题


I have a problem as I want to render view from different controller and pass there datas. Do You know how to do it?

I was trying:

$this->renderScript('index/index.phtml')->entries = $result;

But my if:

if (count($this->entries) <= 0)

return 0

Do You know how to do it? THANKS!


回答1:


Do you mean you just want to render a different controller action's view script?

$this->view->entries = $result;
$this->_helper->viewRenderer('index/index', null, true);

Check out the manual page for the ViewRenderer helper.




回答2:


Render view with action's output data.

in view page you wish to display data write this simple code.

echo $this->action('list','users','main');

list is my action name

users is my controller name

main is my module name (if module using in your project).



来源:https://stackoverflow.com/questions/4856928/zend-rendering-different-view-with-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!