You can use this technique for simple forwarding to private action and
including its result template (to use with template-toolkit):
I defined a dynamic filter:
iforward => [
sub {
my ($context, $c, $args) = @_;
return sub {
my $path = shift; #this is an action uri (for example,
'/schema/list').
my $tpl = $c->stash->{template}; #save template that had
been processed before
$c->forward($path); #call action
my $inc = $c->stash->{template}; #save action template
$c->stash->{template} = $tpl; #restore original template
return $context->include(
$inc,
($args && ref $args eq 'HASH') ?
{%{$c->stash}, %{$args}} : #need to
update template toolkit's stash
$c->stash
); #return template processing result back to parent
template
};
}, 1
],
Usage of this is simple (in template):
Schemas list: <br />
[% '/schema/list' | iforward(c, additional => 'args') %]
You could use something like that for mason.
P.S. We cannot use something simple like this:
[%CALL c.forward('...') %][%INCLUDE its_template%]
because template toolkit's stash is not changed when catalyst's stash is
change after the start of processing parent template.
2007/5/17, John Goulah <[EMAIL PROTECTED]>:
Theres probably not one specific answer for this, but I was curious on
peoples opinion. I'm basically trying to figure out what is the best way to
create componentized views, such as Mason components allows you do reuse
pieces of the page that are cachable. Would this basically be done on the
template level pulling in pieces of various smaller templates into a bigger
wrapper like template, and forwarding (or perhaps chaining) within the
controller to gather the data that gets passed into it? What are peoples
thoughts on the best way to reuse as many parts of the page as possible when
certain pieces are used on many pages within the app?
Thanks!
John
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/