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 --%>

Quote Reply
Re: [scorpioncapital] Variable scope in template <%loop%> tag In reply to
Check the help docs for using <%set %> to create a holding variable. That might do what you want.

PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.