3

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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Does this work if the action/controller is in a different module?
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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.