You can probably place that common code in your preDispatch() hook:

if ($article = $this->_request->getParam('article')) {
    // Load article and assign to view
}

--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com



On Fri, Oct 29, 2010 at 3:32 PM, debussy007 <[email protected]> wrote:

>
> Hi,
>
> That's a recurring problem I have had for a long time :
>
> Let's say I have an action allowing to view an article, and an action
> allowing to edit an article.
>
> To setup the views, the code is the same for both actions (get the article
> id from GET parameter, fetch article, execute some checks, and other
> things). Only the view files are different, in the edit version, there is a
> form with input elements.
>
> I have here duplicated code. How would you handle this ?
>
> Thank you for any advice
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/MVC-design-question-tp3019840p3019840.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

Reply via email to