[Catalyst] Store something in the stash at startup

Charlie Garrison garrison at zeta.org.au
Wed Aug 18 13:47:15 GMT 2010


Good evening,

On 18/08/10 at 11:04 AM +0100, Tomas Doran 
<bobtfish at bobtfish.net> wrote:

>Does this make sense how this would work? I'm not saying you want this
>facility _right now_, just that when you come to want it, it's nice if
>your template is already flexible - which is why I'd try to have the
>controller pass all the data your template is going to operate on into
>the template, rather than have the template reaching into the model..

Thinking about all this a bit more... as a rule of thumb should 
I never call $c methods from the view? Is that an indication 
there is flawed logic elsewhere and all data the view needs 
should really be in the stash.

I just checked one view template to see how I was using the 
context object, and I make calls to 7 different methods, some of 
which I don't think I could easily stash due to parameters that 
get passed (eg. uri_for_action).

So if there are some context methods that I really do want to 
use, that means I've already got requirement for the context in 
my view, so why not just use context as much as needed.

Note, I'm not challenging the idea of putting (most) everything 
in stash, just trying to get a handle on the line between using 
methods from context and data in stash. My usage currently has 
large gray area (eg. c.user vs user); where should I draw the line?

Thanks again,
Charlie

-- 
    Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt



More information about the Catalyst mailing list