Hi - to answer your question, you want the action() helper, which I can't
find the manual page for at the moment! It's in Zend_View_Helper_Action,
and looks like
/**
* Retrieve rendered contents of a controller action
*
* If the action results in a forward or redirect, returns empty string.
*
* @param string $action
* @param string $controller
* @param string $module Defaults to default module
* @param array $params
* @return string
*/
public function action($action, $controller, $module = null, array
$params = array())
However, this is an expensive call - take a look at the performance guide
for suggestions on how to improve this.
Another option that may help to solve your problem would be to adhere to the
"fat model, skinny controller" paradigm. By having most of the work in the
model, you will be able to reduce your code duplication significantly.
Cheers,
Mark
Steven Szymczak wrote:
>
> Hi there,
>
> I've got a blogging system that includes an action, in the view
> controller, that pulls the most recent entries from the database and
> displays them. However, I also want the most recent posts to be
> summarized on the index page, as well. Right now I'm repeating a lot of
> code to get the job done, so I'd like to know if there's a way to call
> actions, from the blog's view controller, in the index controller.
>
> I don't know if it matters, but I'm using a module layout like:
>
> application/
> config/
> filters/
> ...
> modules/
> blog/
> default/
> data/
> ...
>
> Cheers,
> -- Steven
>
>
--
View this message in context:
http://www.nabble.com/Calling-actions-from-a-different-controller-tp23530697p23535884.html
Sent from the Zend Framework mailing list archive at Nabble.com.