I have created a template global called get_parents:
sub { # Get the parents of an ID
my $category_id = shift;
my $category = $DB->table('Category');
my $parents = $category->parents ( $category_id );
return $parents;
}
In the template I call this sub-routine as <%set data=get_parents(84)%>
A dump of the returned data is: (why the backslash '\' ?)
\[
'3',
'396',
'64'
]
The parent id numbers being returned are correct. But, I can't access them in the template. I have tried:
<% data %>
<% $data %>
<% data[0] %>
<% $data[0] %>
<% @data[0] %>
<% @$data[0] %>
Please tell me what I'm doing wrong.
Thank you,
Roger
______________________________
Roger "Teresk" Brown
Stratics Central Content Director
Stratics Forums Programmer
Guild Forums Administrator
teresk@stratics.com
Code:
sub { # Get the parents of an ID
my $category_id = shift;
my $category = $DB->table('Category');
my $parents = $category->parents ( $category_id );
return $parents;
}
In the template I call this sub-routine as <%set data=get_parents(84)%>
A dump of the returned data is: (why the backslash '\' ?)
\[
'3',
'396',
'64'
]
The parent id numbers being returned are correct. But, I can't access them in the template. I have tried:
<% data %>
<% $data %>
<% data[0] %>
<% $data[0] %>
<% @data[0] %>
<% @$data[0] %>
Please tell me what I'm doing wrong.
Thank you,
Roger
______________________________
Roger "Teresk" Brown
Stratics Central Content Director
Stratics Forums Programmer
Guild Forums Administrator
teresk@stratics.com