Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [Printsite] Simple question about variables & GT-module

Quote Reply
Re: [Printsite] Simple question about variables & GT-module In reply to
Hi,
I'm not exactly sure what you want to do but here is a basic example for you to start with -

Create a Template Global called -
test
(or any name you like) and include the following code -


sub {
#make existing variables available
my $tags = GT::Template->tags;

#do something here
#existing variables will be available using -
$tags->{variable_1_name};
$tags->{variable_2_name};
#etc, etc........

#assign new variables to be available in your template
$tags->{new_variable_1}="something";
$tags->{new_variable_2}="something else";
#etc, etc........


#if you want to return something to your template
my $output="Return something to your template";
#note new variables will be returned and don't need to be included here

#return the result to your template
return $output;
#or if you have nothing to return you can just use -
# return;

#end sub
}



You can call the sub from your template using -
<%test%>
(or whatever name you used for the sub)

Hope that helps.
Simon.
Subject Author Views Date
Thread Simple question about variables & GT-module Printsite 3278 Sep 27, 2004, 1:58 PM
Thread Re: [Printsite] Simple question about variables & GT-module
jai 3160 Sep 28, 2004, 4:18 PM
Thread Re: [jai] Simple question about variables & GT-module
Printsite 3149 Sep 29, 2004, 10:06 AM
Post The post can be deleted!
Printsite 3148 Sep 29, 2004, 2:33 PM