Andy,
Categories are not in scope of category.html.
Therefore, I can not do as it returns nothing:
<%if Name eq 'foo'%>
<li><a href="<%escape_html URL%>"><span><b>foo</b></span></a></li>
<%endif%>
<%endloop%>With your help I was able to add the following Template Global Subroutine :
my $category_loop = $_[0];
my @new_categories;
foreach (@$category_loop) {
$_->{ID}, $_->{Full_Name}, $_->{Description}
}
return { category_loop => \@new_categories };
}Then, I called it using the following:
<%if Name eq 'foo'%>
<li><a href="<%escape_html URL%>"><span><b>foo</b></span></a></li>
<%endif%>
<%endloop%>When I did the above, the bullet item was returned fine. However, next to it, there was an error printed as in "Error: endloop found outside of loop"
Then, you said that the call is wrong and the correct one should be:
<%loop category_loop%>
<%if Name eq 'foo'%>
<li><a href="<%escape_html URL%>"><span><b>foo</b></span></a></li>
<%endif%>
<%endloop%>When I did this, I the bullet item was not displayed and still got the same error: "Error: endloop found outside of loop"
Thank you for your patience and appreciate your help.
Categories are not in scope of category.html.
Therefore, I can not do as it returns nothing:
Code:
<%loop category_loop%> <%if Name eq 'foo'%>
<li><a href="<%escape_html URL%>"><span><b>foo</b></span></a></li>
<%endif%>
<%endloop%>
Code:
sub { my $category_loop = $_[0];
my @new_categories;
foreach (@$category_loop) {
$_->{ID}, $_->{Full_Name}, $_->{Description}
}
return { category_loop => \@new_categories };
}
Code:
<%tweak_category_loop($category_loop)%> <%if Name eq 'foo'%>
<li><a href="<%escape_html URL%>"><span><b>foo</b></span></a></li>
<%endif%>
<%endloop%>
Then, you said that the call is wrong and the correct one should be:
Code:
<%tweak_category_loop($category_loop)%> <%loop category_loop%>
<%if Name eq 'foo'%>
<li><a href="<%escape_html URL%>"><span><b>foo</b></span></a></li>
<%endif%>
<%endloop%>
Thank you for your patience and appreciate your help.