views:

45

answers:

1

I have a view and I want to display data that would be generated by othe modules and controllers on the page.

What is the best way to do this?

For example: If on a certain page I want to pull in the latest news from the news module.

+3  A: 

There's a view helper called Action which allows you to call another controller's action (and display the markup generated).

I would add an action called latestNewsAction that renders a latest news panel/div/list and call that using the action view helper.

David Caunt
Does this work if the action/controller is in a different module?
Jesse Lesperance
@Jesse: yes, it does. See third parameter, and read the doc.
erenon
Yep, and you can pass params in an array as the 4th parameter to the helper, especially useful if you need a way of telling the view to do something *slightly* different when it's called from another view!
David Caunt