I'm set the wrapper on myapp::View::TT.pm
__PACKAGE__->config(
TEMPLATE_EXTENSION => '.tt2',
WRAPPER => 'wrapper.tt2',
INCLUDE_PATH => [ha->path_to('root', 'src'),],
render_die => 1,
TIMER => 0,
);
and then create wrapper.tt2 with this content
[% IF no_wrapper;
debug("Passing $template.name without any wrapper");
content;
ELSE;
wrapper = wrapper || 'site_wrapper.tt2';
debug("Applying $wrapper to $template.name");
content WRAPPER $wrapper;
END;
%]
Then, in Admin controller I wrote
sub begin :Private {
my ($self, $c) = @_;
$c->stash( wrapper => 'admin/admin_wrapper.tt2');
}
And that works fine.
But in Root Controller I can't set Wrapper and does't have wrapper. I have wrapper site_wrapper.tt2, but I cant use it.
In Root controller I have
sub begin :Private {
my ($self, $c) = @_;
$c->stash( wrapper => 'site_wrapper.tt2');
}
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
# Hello World
$c->response->body( "ok" );
}
and thats output only "ok". how can I use wrapper on Root?
Thanks.
By putting something into $c->response->body(), you override any template processing. I don't think there's anything intrinsically wrong with what you're doing as far as the WRAPPER
directives are concerned.