my approach in cases like this has been to have models/database tables for the pages themselves.

- a page has_many components
- a controller queries the db for the components to display on the page[*] and stashes the list - the controller, now knowing which components will be displayed, stashes the appropriate data
- the template loops the list of components and includes each one
- the editor uses an admin interface to select which components to display on each page

[*] i've done this via attributes, so any action method marked :CustomizablePage gets preprocessed by a Catalyst::Action subclass that populates $c->stash-{show_comps}


On Apr 25, 2007, at 8:07 AM, Carl Johnstone wrote:

Maybe I am confused about MVC, but wouldn't you want the view to decide how to present what is sent to it by the controller, and hence have the controller
handle this?

I don't know if it's you that's confused or me that's confused ;-) I can see your point of view though.

From my point of view, the "View" is handled by a designer. The designer
knows about HTML, CSS, JS, and enough about TT to get them going. They typically wouldn't know anything about perl.

When the designer assembles the pages he decides which of the possible common elements is going on each page and will include the relevant sub-templates. It makes sense for me to be able to delegate control of that to the designer by just letting them include what they like without having to be involved every time something changes.

As an example during the summer the designer might take the football league tables off the site in favour of something else. In my Controller though the code that generates that data will still be run even though it's now redundant.

Carl



_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ [email protected]/
Dev site: http://dev.catalyst.perl.org/

---
michael reece :: software engineer :: [EMAIL PROTECTED]



_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to