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

Bill Moseley moseley at hank.org
Wed Apr 25 17:10:50 GMT 2007


On Wed, Apr 25, 2007 at 10:41:12AM -0400, Joe Landman wrote:
> > What Steve wants is some way of being able to decide in the View 
> > which of those elements are included and load them accordingly.
> 
> ... and this should be done at the controller level is what I am saying.  You
> can even have your controller select a particular view based upon the
> available data if you wish.  Or have a single view template handle everything
> (and only render bits that are defined, which is what I had indicated, this
> way you do not have to construct everything, just what you need).

I think it's hard to generalize as it's dependent on the application
and the specific action how much work the controller has to do up
front.

I might have a page that displays a user and their related
information, and all I might put in the stash is the user object.
Then in the templates:

    <div id="content">
    [%
        PROCESS personal_info;
        PROCESS tasks IF user.has_tasks;
        PROCESS alerts IF user.has_alerts;
        PROCESS calendar;
    %]
    </div>

Or something like that.  Seems natural and allows the template
designers to decide what elements to include and the structure of the
resulting page.

No clue how that works in Seamstress.

-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list