Thank you, brewt! I now have it working properly!!
Just a side note for others that might want to use this code:
Where I said "In the template I call this sub-routine as <%set data=get_parents(84)%>"... that needs to change to "<%get_parents(84)%>". The assignment to "data" is now being made in the template global.
The template global is now:
sub { # Get the parents of an ID
my $category_id = shift;
my $category = $DB->table('Category');
my $parents = $category->parents ( $category_id );
return { data => $parents };
}
The dump of the data:
[
'3',
'396',
'64'
];
And the template is "<%get_parents(84)%>parents: 0:<%data.0%>, 1:<%data.1%>, 2:<%data.2%>"
Which now displays: "parents: 0:3, 1:396, 2:64".
Thanks again, brewt!
Roger
______________________________
Roger "Teresk" Brown
Stratics Central Content Director
Stratics Forums Programmer
Guild Forums Administrator
teresk@stratics.com
Just a side note for others that might want to use this code:
Where I said "In the template I call this sub-routine as <%set data=get_parents(84)%>"... that needs to change to "<%get_parents(84)%>". The assignment to "data" is now being made in the template global.
The template global is now:
sub { # Get the parents of an ID
my $category_id = shift;
my $category = $DB->table('Category');
my $parents = $category->parents ( $category_id );
return { data => $parents };
}
The dump of the data:
[
'3',
'396',
'64'
];
And the template is "<%get_parents(84)%>parents: 0:<%data.0%>, 1:<%data.1%>, 2:<%data.2%>"
Which now displays: "parents: 0:3, 1:396, 2:64".
Thanks again, brewt!
Roger
______________________________
Roger "Teresk" Brown
Stratics Central Content Director
Stratics Forums Programmer
Guild Forums Administrator
teresk@stratics.com