[ic] Results.html and tables?

Mike Heins interchange-users@interchange.redhat.com
Tue Dec 11 12:42:02 2001


Quoting Paul Jordan (jordan@gishnetwork.com):
> I am new to xml and IC but have completely customized the IC foundation to a
> fully functional store. However I am still having problems getting over some
> hurdles. Mostly just trying to understand and figure out how this stuff
> works, but I am trying-
> 
> OK, my problem. My partners think my results.html page is not utilizing
> space well. As you know it loops through a search and displays them one
> below the other. I agree with them though. Is there a way to display the
> results like maybe 2 or 3 across and 2 or 3 down. You know?
> 
> Like lets say I am selling pictures and I would like to display results
> going 3 across (left to right) and 3 down, although I don't care how many
> down it goes. I can control that search amount, that is easy enough.  I have
> no idea how to begin. Would I create 2 search lists?

Look at [PREFIX-alternate N] in the docs.

There is an example at:

    http://interchange.redhat.com/cgi-bin/ic/docfly.html?mv_arg=icfaq14%2e02

An excerpt:

A common need when building tables is to conditionally close the table
row or data containers. I see a lot of:

    [loop search="ra=yes"]
        [calc] return '<TR>' if [loop-increment] == 1; return[/calc]
        [calc] return '' if [loop-increment] % 3; return '</TR>' [/calc]
    [/loop]

Much faster, by a few orders of magnitude, is:

    [loop search="ra=yes"]
	    [loop-change 1][condition]1[/condition]<TR>[/loop-change 1]
	    [loop-alternate 3]</TR>[/loop-alternate]
	    [/loop]

If you think you need to close the final row by checking the final
count, look at this:

    [loop search="ra=yes"]
            [on-match]
    <TABLE>
	<TR>
    [/on-match]

    [list]
	  <TD>[loop-code]</TD>
    [loop-alternate 3]
	</TR>
	<TR>
    [/loop-alternate]
    [/list]

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

    [no-match]
	No match, sorry.
    [/no-match]

[/loop]

This is a hundred times faster than anything you can build with multiple
[calc] tags.


-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

How far can you open your mind before your brains fall out?