[Catalyst] Page layout w/Catalyst

Andy Grundman andy at hybridized.org
Wed Dec 14 04:13:52 CET 2005


Kaare Rasmussen wrote:
> Hi
> 
> As I'm new to Catalyst and TT I'd like to ask for advice about which bit will 
> control what part of my page layout.
> 
> The layout I'm planning to use has 
> - A top part that rarely will change (perhaps breadcrumbs or some similar
>   though)
> - A left menu. I'm thinking to use Tree::Simple
> - A bottom part for status information. I'd like to put validation info here
>   too.
> - And finally the work area (central) where record lists and update pages will
>   go.
> 
> My first idea is to have Catalyst control it all. Does anyone think that TT 
> does a better job? Or does anyone think this is a stupid way to do things?

TT is great for this.

Every template just does something like:
[% WRAPPER header.xhtml %]

page content here

[% END %]

And in header.xhtml you have it construct the page:

<!-- static header stuff -->

[% PROCESS left_menu.xhtml %]
[% PROCESS breadcrumb.xhtml %]

[% content %] <- page content is inserted here

[% PROCESS footer.xhtml %]

For the variables to use in each section, use auto sections at the appropriate 
level.  For variables that are used on every page, put them in the top-level 
auto (MyApp.pm).  Controller-specific vars go in the controller's auto, and so on.

-Andy



More information about the Catalyst mailing list