Zend Framework: Controller class == Page?

model-view-controller, php, zend-framework

Solution

I suppose thats one way of doing it... Using your analogy i suppose i use a controller like a "section" and actions like "pages" to those sections.

But thats getting stuck more on the old procedural||static paradigm of pages because really the action controller itself has no more to do with a page or section than the association you make as a developer. Ie. each page can potentially be a composite of numerous actions and views depening on the application's architecture.

For example if i have a blog modules i might have the following:

Controllers:

- PostController

- CommentController

Views:

- post

- display (display a single post)

- list (list posts)

- edit (create/edit post)

- comment

- display (display n comments)

- list (list comments)

- edit (create/edit/moderate comment)

- embed-list (for use on the Post itself assuming this differs from display)

Problem

Am I right in thinking that in Zend Framework, if I plan to have 5 pages at my site, I'd generally need 5 controllers? Do ZF developers typically create 1 controller per page ("page" as abtract app unit)? The reason I am asking this is that previously for some reason I stuffed a lot of various actions into controllers so that they played role of pages, e.g. index/add, index/view, index/delete and displayed various small screens, e.g. small CRUD screens as opposed to grids displayed by index action. But as of now I want to check my new understanding that actions are needed mostly for model updates and actions should, once run, immediately redirect back to controller/index. So it seems that views should mostly be used in index actions, and less frequently in other actions. Does this sound architecturally valid?

Original source