Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

passing globals to plugin template

Quote Reply
passing globals to plugin template
Ok -- so I have a plugin that parses a custom template. How do I pass in the globals set so they are accessable/parsed in the template?

Code:

sub handle_add {
# -------------------------------------------------------------------
# This subroutine will get called whenever the hook 'handle_add'
# is run. You should call GT::Plugins->action ( STOP ) if you don't
# want the regular code to run, otherwise the code will continue as
# normal.
#
my (@args) = @_;
# Do something useful here
# my $p = (ref $_[0] eq 'HASH') ? shift : {@_};

if ($args[0] == undef){
use GT::Template;
my $msgtitle = "test";
my $tmplroot = $CFG->{admin_root_path}."/templates/".$CFG->{build_default_tpl};
my $body = GT::Template->parse('add_start.html', { Title => $msgtitle } , {root => $tmplroot});
print $IN->header;
print "$body";
print Dumper(\@args); GT::Plugins->action ( STOP );

} else {
print $IN->header;
print Dumper(\@args);
return @args;
}
}
Subject Author Views Date
Thread passing globals to plugin template Swaylock 1512 Apr 8, 2004, 4:38 PM
Post Re: [Swaylock] passing globals to plugin template
Swaylock 1464 Apr 8, 2004, 4:55 PM