[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] Item-alternate leaves unnecessary white space



On Tuesday, March 25, 2003, at 11:54  PM, SofaKingRotten wrote:

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

We had exactly the same problem. The only way I could make it work was to implement my own counter, which _does_ make it a bit slower.

I've never tried [table-organize] as Dan suggested, but that might work better.

At any rate, here's the code from my results page. Note that I removed another [item-change] I had in there to make some things in our store work, so this code is untested, but it should work fine. We also use some custom field names. Hope it helps!

Josh
-------------

[on-match]
  <TABLE cellspacing="0" cellpadding="15" border="0">

[/on-match]
[search-list]

[item-change cat]
[condition][item-field Category][/condition]
[perl no_return=1]$tmp_increment=0[/perl]
<TR align="left">
<td width="100%" align="left" colspan="4"><h2>[item-field Category]</h2></td>
</tr>
<tr align="center">
[else]
[/else]
[/item-change cat]

  <TD width="115" valign="top" align="left">
<table>
<tr>
<td height="85">
[page [item-code]]<IMG SRC="items/[if file /www/htdocs/shop/images/items/t-[item-code].jpg]t-[item- code].jpg[else]noimageyet.gif[/else][/if]" BORDER="0"></a>
</td>
</tr>
<tr>
<td>
  <p class="results">[page [item-code]]<b>[item-description]</b></a>
  <br>[item-price]</p>
</td>
</tr>
</table>
  </TD>

[perl no_return=1]++$tmp_increment[/perl]

[if explicit]
[condition]
   return 1 if $tmp_increment % 4 == 0;
   return 0;
[/condition]
</TR><TR align="center">
[else]
[/else]
[/if]

[/search-list]
[on-match]
  </TR>
  </TABLE>
[/on-match]

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.