[Catalyst] A View that may include elements optionally returnedfrom other funcs

Michael Reece mreece at vinq.com
Wed Apr 25 19:39:04 GMT 2007


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: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/ 
> catalyst at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

---
michael reece :: software engineer :: mreece at vinq.com





More information about the Catalyst mailing list