> On reading the docs on partials, it doesn't say where these
> should be put in a convention-based app (I know CakePHP
> defaults to views/ elements for its equivalent).

You can put them anywhere, but unlike Cake, you have to path to them.
(In fact this is the only real difference - CakePHP knows the path in
advance, while Zend lets you pick your own. Yay! Zend.)

I tend to put them in a partials folder underneath the view folder that
uses them. More global partials go in its own folder in the root of the
views folder.

> Should I implement these different form sections/elements as separate
controller actions? 

I would. You could have one big controller action, that switches out the
partials, but this may become unwieldy over time. Best to have a set of
action steps, and keep them all small and lean. It will be much easier
to diagnose bugs, etc.

Remember, keep your models fat, your controllers skinny, and your views
as big as they need to be for display (but no bigger - bigger == undue
logic in the view).
 
--
Eric Marden


-----Original Message-----
From: Marcus Bointon [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 14, 2008 7:52 PM
To: [email protected]
Subject: [fw-general] MVC/Layout for an expanding form

I'm building an app that's really one big expanding form (as you answer
questions, more appear), buttons to add chunks to it etc, and I'm not
clear how to make it fit neatly with a Zend MVC (with layout) structure,
or what level of granularity to use in the MVC structure.  
For example, I have a repeatable section that can be added dynamically
to the form multiple times, and that in turn needs to make ajax calls to
determine the contents of various pop-up menus as you select them.

Should I implement these different form sections/elements as separate
controller actions? If so, I can see this single form using 20-30
actions. Is that 'normal'? When a visitor returns to the form, I can see
that I'll need even more actions to rebuild it. Any suggestions how best
to approach this?

On reading the docs on partials, it doesn't say where these should be
put in a convention-based app (I know CakePHP defaults to views/
elements for its equivalent).

Thanks,

Marcus
--
Marcus Bointon
Synchromedia Limited: Creators of http://www.smartmessages.net/ UK
resellers of [EMAIL PROTECTED] CRM solutions [EMAIL PROTECTED] |
http://www.synchromedia.co.uk/


Reply via email to