[Catalyst] :Template() Attribute

Zbigniew Lukasiak zzbbyy at gmail.com
Mon Jun 18 10:28:36 GMT 2007


When we are at this View refactoring.  When changing the template you
need to put the whole path on stash ( $c->stash( template =
template_path/template.tt) ).  What I would propose is that the view
automatically used the $c->action->namespace as the template_path - so
that you would not need to specify the full path - only the template
name.

This would mean less typing in most common case but also should be
useful when inheriting from a base controller - since it would
automatically adjust the template paths - and that is what you need in
most cases as well.  The ideal would be if it would search the
template directories of respective controller classes in the
inheritance tree - but I have no idea how to accomplish that.

--
Zbyszek

On 6/17/07, Jonathan Rockway <jon at jrock.us> wrote:
> On Sunday 17 June 2007 01:02:52 pm Christopher H. Laco wrote:
> >
> > Well, if we're throwing things in the ring...
> >
> > C::View::Templated
> >
> > ->template()
> >
> > And some forms of:
> >
> > ->template_paths(\@)
> >
>
> I like this.  Should we put this in a separate package, or right in C-Runtime?
>
> Incidentally, you could do $c->view->template('...')* instead of
> $c->stash->{template}, which looks pretty nice.
>
> * or $c->view('View::TT')->template('...') if you don't like default_view.
>
> --
> package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
> $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
> ";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/



More information about the Catalyst mailing list