Hoi,
I'd like to know if it's possible to test if me loop returns anything. i have a problem where i've made a custommodule that returns a collection of searchresults, which i list in my template with the following code:
---
<table>
<tr>
<td>Name</td>
<td>Email</td>
<td>Department</td>
<td>Phone</td>
<td>Country</td>
<td>Local</td>
<td>LogonName</td>
</tr>
<!--@LoopStart(SearchResult)-->
<tr>
<td><!--@cm.Name--></td>
<td><!--@cm.Email--></td>
<td><!--@cm.Department--></td>
<td><!--@cm.Phone--></td>
<td><!--@cm.Country--></td>
<td><!--@cm.Local--></td>
<td><!--@cm.LogonName--></td>
</tr>
<!--@LoopEnd(SearchResult)-->
</table>
---
The problem is that if my search returns 0 items, the ''table headers'' are rendered, which looks kinda stupid.
---
<table>
<tr>
<td>Name</td>
<td>Email</td>
<td>Department</td>
<td>Phone</td>
<td>Country</td>
<td>Local</td>
<td>LogonName</td>
</tr>
</table>
---
So i wanna know if i can somehow test if my returns anything. I imagine something like this:
---
<!--If Defined(<!--SearchResult)-->
<table>
<tr>
<td>Name</td>
<td>Email</td>
<td>Department</td>
<td>Phone</td>
<td>Country</td>
<td>Local</td>
<td>LogonName</td>
</tr>
<!--@LoopStart(SearchResult)-->
<tr>
<td><!--@cm.Name--></td>
<td><!--@cm.Email--></td>
<td><!--@cm.Department--></td>
<td><!--@cm.Phone--></td>
<td><!--@cm.Country--></td>
<td><!--@cm.Local--></td>
<td><!--@cm.LogonName--></td>
</tr>
<!--@LoopEnd(SearchResult)-->
</table>
<!--EndIf Defined(<!--SearchResult)-->
---
Is it possible?
/Martin