Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Variable scope in template <%loop%> tag

Quote Reply
Variable scope in template <%loop%> tag
I want to place a category title (title_linked tag) above a search.cgi result but ONLY if the category has changed, i.e. every link searched is associated with a category using the title_linked variable in the link_loop_results. However, I'm not sure how to check if it has changed because you need to compare with the previous/next iteration of the loop.

Here's what I got so far but it doesn't seem to work exactly...


<%loop link_results_loop%>
<%if first%> <%-- set up the opening table --%>


Check if link is in a new category, if so display it


<%if prevcat%>
<%if prevcat != $title_linked%>
<TR><TD><span class="hi_orange"><%title_linked%></span><br></TD></TR>
<%set prevcat = $title_linked%>

<TR><TD><span class="hi_orange"><%title_linked%></span><br></TD></TR>

<%-- Pull Individual Link Format --%>
<%include linkGallery.html%>
<%ifnot row_num % 4%> <%-- close the row --%>

<%if last%> <%-- close the table --%>
<%if row_num % 4 eq 1%> <%-- balance the trailing rows --%>
<%if row_num % 4 eq 2 %> <%-- balance the trailing rows --%>

Subject Author Views Date
Thread Variable scope in template <%loop%> tag scorpioncapital 1319 Aug 28, 2003, 8:43 AM
Post Re: [scorpioncapital] Variable scope in template <%loop%> tag
pugdog 1229 Aug 28, 2003, 2:58 PM