-- Matthew Weier O'Phinney <[email protected]> wrote
(on Sunday, 08 February 2009, 10:19 AM -0500):
> -- Aspra Flavius Adrian <[email protected]> wrote
> (on Sunday, 08 February 2009, 01:45 PM +0100):
> > Hi. How could I trigger another /module/controller/action in order to
> > catch its output which should then be displayed inside a dojo
> > container?
> >
> > Imagine the /default/index/index rendering the "homepage", which
> > should contain several blocks like "the latest forum entries" (from
> > /forum/index/latest) and "best wiki articles" (from /wiki/index/best).
>
> If you're indeed using Dojo, consider using ContentPane's with the
> "href" attribute pointing to actions that have the content you wish to
> display. That approach will require more requests, but be very dynamic.
>
> The other possibility is to use one of the following:
>
> * partial() view helper allows you to specify the module in which to
> look for the view script.
>
> * action() view helper dispatches another action and returns the
> content
>
> * ActionStack action helper/plugin will allow you to specify one or
> more actions to perform during the request lifecycle. Have each
> render to a distinct response segment, and build the final output in
> your layout script.
>
> In terms of performance, ActionStack will be faster than partial(), which
> will in turn be faster than action(). However, partial() and action()
> allow you to build the view within a single action view script, while
> ActionStack will require a different strategy.
And I should probably go on record to recommend against action() and
ActionStack, really. Most of the time if you find yourself doing that,
it means you're executing application logic within your action
controllers -- logic that is usually best implemented in your models.
A more appropriate solution would be one of the following:
* Creation of a view helper that interacts with the necessary model
and builds the appropriate display
* Passing the appropriate model to the view and then render()ing an
additional view script within it (or calling partial() and passing
the model).
--
Matthew Weier O'Phinney
Software Architect | [email protected]
Zend Framework | http://framework.zend.com/