I figured out my answer with help from this thread
my $tags = GT::Template->tags;
my $id = $tags->{ID};
my ($table, $field) = @_;
my $sth = $DB->table($table)->select({ $field => $id});
my @output;
while (my $rs = $sth->fetchrow_hashref ) {
push @output, $rs;
}
return { loop_hash => \@output };
}
Change {ID} if neccessary to the ID column name, and call with:
Code:
sub { my $tags = GT::Template->tags;
my $id = $tags->{ID};
my ($table, $field) = @_;
my $sth = $DB->table($table)->select({ $field => $id});
my @output;
while (my $rs = $sth->fetchrow_hashref ) {
push @output, $rs;
}
return { loop_hash => \@output };
}
Change {ID} if neccessary to the ID column name, and call with:
Code:
<%name_of_above_sub('related_table_name', 'related_column_in_related_table')%>