[ic] Item-alternate leaves unnecessary white space

SofaKingRotten interchange-users@icdevgroup.org
Wed Mar 26 00:57:00 2003


Hi,

Using IC4.8.5 on Redhat 7.2, default db, foundation.
I'm having trouble finding a solution to this problem
using the [item-alternate] tag. I use it on the
results page to display 4 items per row, like this
[item-alternate 4]:

Category#1
X  X  X  X
X  X  X  X

Category#2
X  X  X  X
X  X  X  X
etc.

However, I have several categories and less than 4
items in some categories. This causes it to alternate
leaving white space, for example, Category#2 starts
out with item#4, so it alternates, as it should:

Category#1
X X X

Category#2
X
X X X X
X X
etc.

I need to alternate *only* if I am in the 4th column
*unless* the category changes. How is this best
overcome? I have been trying to implement some sort of
counter using [calc] and [scratch] testing for column
number 4, etc., but I just can't get it, and it seems
too slow. I have looked into the looping tags but I
don't quite understand them all. I've checked the mail
archives but I am not sure what tag I should be using
or what term to search on. Below is an example of my
standard and 'counting column' code.

Thanks to anyone who can offer any help!

SKR
_________________________________

Here is my standard working code:

<table>
[search-list]
[item-change 1][condition][item-field
category][/condition]
    <tr> 
        <td colspan="4">[item-field category]</td>
    </tr>
    <tr valign="bottom">
[/item-change 1]

<th><IMG SRC="thumb/[item-code]_b.jpg"></th>

[item-alternate 4]</tr><tr valign="bottom"><td
colspan="4"></td></tr>
<tr valign="bottom">[else][/else][/item-alternate]

[/search-list]
</tr>
</table>

Here is my attempt at counting columns. I think it
would work if it ever compared to < 4 correctly:

<table>
[search-list]
[item-change 1][condition][item-field
category][/condition]
    <tr> 
        <td colspan="4">[item-field category]</td>
    </tr>
    <tr valign="bottom">
<!-- reset column counter on new category-->
[seti col_count]0[/seti]
[/item-change 1]

<!-- add 1 to the counter which indicates column # -->
[seti col_count][calc][scratch col_count] +
1[/calc][/seti]
<th><IMG SRC="thumb/[item-code]_b.jpg"></th>

<!-- if column # is equal to 4, terminate the row,
else -->
[if type=data term="[scratch col_count]" op="<"
compare="4"][else]</tr><tr valign="bottom"><td
colspan="4"></td>
    </tr>
    <tr valign="bottom">[seti
col_count]0[/seti][/else][/if][/search-list]
    </tr>
</table>

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com