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

Emily Heureux emily at burnham.org
Fri Nov 30 00:31:57 GMT 2007


Huh?  I don't receive digests on this mail list, just individual emails.

I did not try it yet, but I just picked two other guys' brains about where
to put these two lines you suggested:
MyApp->config->{default_view} = 'Foo';

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

They weren't sure, but suggested *.yml or MyApp.pm.  I was thinking Root.pm,
but not sure.  I will try all until it works, or I find more info.  I will
check documentation for $c->view as well.

Thanks for all the help,
Emily

(ohhh I did get a digest on the dev list, where I wasn't supposed to be.
Sorry about that.)

-----Original Message-----
From: Matt S Trout [mailto:dbix-class at trout.me.uk] 
Sent: Thursday, November 29, 2007 3:06 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Multiple Views in Catalyst (FW: Catalyst-dev
Digest,Vol 29, Issue 14)

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/

site: http://dev.catalyst.perl.org/





More information about the Catalyst mailing list