[Catalyst] Multiple Views in Catalyst (FW: Catalyst-dev Digest, Vol 29, Issue 14)

Matt S Trout dbix-class at trout.me.uk
Thu Nov 29 23:05:47 GMT 2007


On Thu, Nov 29, 2007 at 01:43:38PM -0800, Emily Heureux wrote:
> Ok, I think I've gotten the correct mailing list now.  Unfortunately, my
> company does not allow irc, so...

Please don't reply to digests. If you're going to be posting, subscribe
properly and reply to the actual messages.

> I would like to have more than one module in View, but I have not found how
> to set that up properly.  I have spent a lot of time on cpan, reading the
> tutorial, and coding examples, experimented on my project, but my lack of
> experience with Catalyst makes it hard to find what I am missing.  It looks
> like, from the suggestions I've gotten so far, that somewhere a default view
> is set (RenderView? end method?) that I need to alter.  What I think would
> be a correct way of starting is,
> 1.  Use the helper script to create a second TT View.
> 2.  Somewhere, do something about the default behavior. (and what if in the
> future I want more than 2 views?)

>From my original message to you:

MyApp::View::Foo
MyApp::View::Bar

MyApp->config->{default_view} = 'Foo';

$c->stash(current_view => 'Bar');

That's how you set the default and per-request view. The docs for $c->view
in Catalyst.pm mention both these settings as well.

Did you try this yet?

-- 
      Matt S Trout       Catalyst and DBIx::Class consulting and support -
   Technical Director      http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Christmas fun in collectable card game form -
                           http://www.shadowcat.co.uk/resources/2007_trading/



More information about the Catalyst mailing list