[Catalyst] modifying the template include_path from the application base

marcus baker marcus.baker at gmail.com
Tue Mar 14 22:41:37 CET 2006


Thanks for getting back to me -- I actually hadn't seen my message
come through on the mailling list, I'd assumed it hadn't made it on
for some reason.

I figured out the issue though, really simple - I'd placed my config
line after the __PACKAGE__->setup instead of before it.  I haven't
seen anything in the documentation mentioning setup() yet, but it does
make sense that configuration should go before it.

Things are going pretty well now, got off the ground with this a lot
faster -- not to bait but I've gotten off of the ground with this a
lot faster than with PHP's Symfony framework, which the coworkers
insist we move to using for everything, ecch.

Thanks

-Marcus

2006/3/14, Jason Kohles <email at jasonkohles.com>:
> On 3/9/06, marcus baker <marcus.baker at gmail.com> wrote:
> > Hi, I'm just dipping into Catalyst for the first time, and having
> > trouble modifying the Template Toolkit's INCLUDE_PATH as directed in
> > the Tutorial.
> >
> > My application is named 'Commencement', and my Template Toolkit view
> > is implemented through Commencement::View::TToolkit.
> >
> > I'd like to have my templates accessible via the 'templates' directory
> > as per the tutorial.  It works if I place the config directive in
> > TToolkit.pm as such:
> >
> > __PACKAGE__->config( { INCLUDE_PATH => [
> > Commencement->path_to('templates') ] } );
> >
> > However it doesn't work if I try to call config directly from my
> > Commencement.pm:
> > __PACKAGE__->config({
> >     name => 'Commencement',
> >     root => __PACKAGE__->path_to('root'),
> >     'View::TToolkit' => {
> >                          'INCLUDE_PATH' => [ __PACKAGE__->path_to('templates') ]
> >                          }
> >                      });
> >
> >
> > Is there something obvious I'm missing here?
> >
> Is your TToolkit.pm in a directory named 'View', or the old-way in a
> directory named 'V'?  You have to be consistent, if the file is in
> MyApp/V/TToolkit.pm, then the key in your configuration has to be
> 'V::TToolkit', if the directory is named View, then the key has to be
> 'View::TToolkit' in order to match it (or at least that's how I
> understand the code, there could be some magic somewhere else that I'm
> not aware of that is making it consistent.)
>
> Also check on startup to make sure that the 'Loaded components' list
> shows your view with a type of 'instance', if it doesn't, then
> something made it think the view wasn't a component (although you
> shouldn't have this problem if inheriting from Catalyst::View::TT,
> I've only seen it when rolling my own views and forgetting to inherit
> from Catalyst::Component.)
>
> --
> Jason Kohles
> email at jasonkohles.com - http://www.jasonkohles.com/
> "A witty saying proves nothing."  -- Voltaire
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>



More information about the Catalyst mailing list