Skip to content

Instantly share code, notes, and snippets.

@pbcj pbcj/gist:975976
Created May 17, 2011

Embed
What would you like to do?
package Template::Toolkit::Plugin::SubTemplate;
use base 'Template::Toolkit::Plugin';
sub new {
my $config = ref($_[-1]) eq 'HASH' ? pop(@_) : { };
my ($class, $context) = @_;
my $self = bless {
_context => $context,
_session => $context->stash->{_session}
}, $class;
return $self;
}
sub load { # called as MyPlugin->load($context)
my ($class, $context) = @_;
return $class; # returns 'MyPlugin'
}
sub process {
my $self = shift;
my $url = shift;
my $template = WebGUI::Asset->newByUrl( $self->{_session}, $url );
return $template->process( $self->{_context}->stash );
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.