[ic] Layout with Interchange

Doug Alcorn interchange-users@interchange.redhat.com
Mon Mar 18 10:29:00 2002


patrice.fabre@armazemdedados.com writes:

> Do you know something to organise better my Table, or do you know if i can
> import a tablle already made and just put TAGS IC to have a loop (verticaly
> and horizontaly).

The trick is that you're trying to put items side by side.  The IC
loop results block is mostly setup to handle one item at a time.
Doing side-by-side is possible but complicated (if someone knows
something easier, be sure and post; maybe 4.8.x has something fancy to
handle this).  Here's what I would recommend: keep a scratch variable
to let you know what to do.  The layout would be something like this:

[set end_of_row]0[/set]
<table ...>
<tr><th>photo</th><th>price</th><th>description</th>
    <th>photo</th><th>price</th><th>description</th></tr>
[search-list]
[if !scratch end_of_row]
<tr>
[/if]
   <td><img src="[item-field image]"></td><td>$[item-price]</td>
   <td>[item-description]</td>
[if scratch end_of_row]
</tr>
[set end_of_row]0[/set]
[else]
[set end_of_row]1[/set]
[/else]
[/if]
[/search-list]
</table>

You'll notice that the end_of_row variable lets you know if you are on
the first item of the row or the second.  If you're on the first item
of the row you need to be sure and open the row with a <tr>.  If
you're on the second row you need to close the row with a </tr>.  Also
note the flip-flop at the end.  Because there's only two items per row
you can just toggle the end_of_row tracking variable with each item.
-- 
 (__) Doug Alcorn - Unix/Linux/Web Developing
 oo / PGP 02B3 1E26 BCF2 9AAF 93F1  61D7 450C B264 3E63 D543
 |_/  mailto:doug@lathi.net http://www.lathi.net