Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Need help with loop

Quote Reply
Need help with loop
Hi,

The following works, but Test Loop (Header) shows up on page 2 even if there is no links available. I assume the same would happen for Test Loop Two (Header).

Questions:

1. Can I stop the Header from showing when no links available.
2. Can I shorten the code and obtain the same results.



<%if link_results_loop.length~%>
<h3>Test Loop:</h3><br>
<%if title_loop.length%>
<%~set formatted_title = Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%>
<p class="category"><%if highlight and query%><%Links::Tools::highlight($formatted_title, $query)%><%else%><%formatted_title%><%endif%></p>
<%~endif%>
<%loop link_results_loop~%>
<%if test eq '3'~%>
<%include link.html%>
<%~endif%>
<%~endloop%>
<br>
<%if link_results_loop.length~%>
<h3>Test Loop Two:</h3><br>
<%if title_loop.length%>
<%~set formatted_title = Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%>
<p class="category"><%if highlight and query%><%Links::Tools::highlight($formatted_title, $query)%><%else%><%formatted_title%><%endif%></p>
<%~endif%>
<%loop link_results_loop~%>
<%if test eq '5' or test eq '4' or test eq '2' or test eq '1' or test eq '0'~%>
<%include link.html%>
<%~endif%>
<%~endloop%>
Subject Author Views Date
Thread Need help with loop rascal 1792 May 30, 2005, 8:05 PM
Thread Re: [rascal] Need help with loop
rgbworld 1742 May 30, 2005, 8:55 PM
Post Re: [rgbworld] Need help with loop
rascal 1745 May 30, 2005, 9:44 PM