>
>From: Bill Moseley <[email protected]>
>To: The elegant MVC web framework <[email protected]>
>Sent: Fri, March 26, 2010 9:15:47 AM
>Subject: Re: [Catalyst] Picking template type based on input
>
>
>
>On Fri, Mar 26, 2010 at 5:50 AM, Tomas Doran <[email protected]> wrote:
>
>>>
>>
>>
>>The controller asks the model for some data, and then chooses how to present 
>>that data (whilst the view actually handles the presentation details.
>>
>
>
>That means the controllers have to be aware of the view. That is, the 
>controllers have to know what view is going to be used so that it can fetch 
>the data needed for that specific view.  Is that what you are saying?
>

I think this is an important point.  Right now the common method in Catalyst is 
for a controller to sorta 'gather data' into the stash primarily via models and 
anything that comes into the system from post or get (and maybe checking the 
flash or session in so cases).  The the controller sort basically lets go of 
the stash and prays the right thing happens.  Usually we have a terminal end 
action based on RenderView which asks a View object to 'do the right thing', 
BUT its that view handler making the choice , like the common TT view (and 
nearly all the other Views do the same thing) which is a handler that 
dispatches to the underlying view templating system based on information from 
the context.  Its a bit too detached I think.

Here's a problem I just recently had.  I'm building a web page which is a 
gallery of images based on search terms.  In the controller I get the incoming 
raw parameters, convert them to a search term object and if that object is 
valid I pass it to a method on my DBIC based schema which returns a resultset 
of images.

Now, this resultset needs to be paged.  I also have some rules to interpret the 
requested page so I can handle cases where someone askes for a page beyond the 
range available in the actual returned resultset.  For that, the controller 
needs to know the size of the page and number of pages, so I created the paged 
set inside the controller... but that means my template authors need to change 
the controller (or a configuration file for that controller) in order to change 
the page size.  To me that is just a display issue, my model and controller 
should be asking the view object "what do you want?" I think.  But right now 
there is no simple way to do this.  Not sure the best solution.

>
>
>
>-- 
>Bill Moseley
>[email protected]
>


      

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

Reply via email to