Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to make result of search in two columns?

Quote Reply
How to make result of search in two columns?
How to make result of search in two columns?

I have made so, but something here is not correct Blush


Code:
<table cellpadding="0" cellspacing="0" border="0">
<tr><td valign="top">
<%loop link_results_loop%>
<%include link.html%>
<%if link_hits = 2*int($link_hits/2)%>
<%if row_num = $link_hits/2%>
</td><td>
<%endif%>
<%else%>
<%if row_num = ($link_hits+1)/2%>
</td><td>
<%endif%>
<%endif%>
<%endloop%>
</td></tr></table>


Thank for the help!
Quote Reply
Re: [Brita] How to make result of search in two columns? In reply to
I don't think that you can do calculations like that within the tags. However you can use the % operator as shown in this thread:

http://www.gossamer-threads.com/...i?post=165554#165554
Quote Reply
Re: [afinlr] How to make result of search in two columns? In reply to
To afinlr

Thank


The amendment: One row and two columns.
Has made so:
Code:
<table cellpadding="0" cellspacing="0" border="0">
<tr><td valign="top">

<%loop link_results_loop%>

<%include link.html%>

<%ifnot link_hits % 2%>
<%set rows = $link_hits%>
<%set rows /= 2%>
<%if row_num = $rows%>
</td><td valign="top">
<%endif%>

<%else%>

<%set rows = $link_hits%>
<%set rows += 1%>
<%set rows /= 2%>
<%if row_num = $rows%>
</td><td valign="top">
<%endif%>

<%endif%>
<%endloop%>

</td></tr></table>

Last edited by:

Brita: Jul 7, 2003, 4:06 AM
Quote Reply
Re: [Brita] How to make result of search in two columns? In reply to
Can someone please advise what changes would be needed to the code snippet Brita has provided above to have links listed in two columns on category pages? If the above code wouldn't work, please advise how to get links into two columns instead of a single column.

Thanks!
Quote Reply
Re: [Karen] How to make result of search in two columns? In reply to
Have you tried using it on a category page? Looks like it should work to me.
Quote Reply
Re: [afinlr] How to make result of search in two columns? In reply to
Hi, yes, I've tried using that code on a category page. I've also tried typical newbie changes to the tags; loop links_loop for example. I'd like to have the links displayed in two columns instead of a single column. Suggestions appreciated. :)
Quote Reply
Re: [Karen] How to make result of search in two columns? In reply to
Yes sorry - there are other tags in this example that need changing - try the one in the link above - I've just tested that and it seems to work.
Quote Reply
Re: [afinlr] How to make result of search in two columns? In reply to
Thanks for the feedback.

---edited---

Found the link you were talking about. Off to try that code. :)

Last edited by:

Karen: Oct 27, 2003, 3:57 PM
Quote Reply
Re: [Karen] How to make result of search in two columns? In reply to
Woohoo! With a bit of tweaking, the code is working super.

Code:


<!--BEGIN 2-COL LINK LOOP-->
BEGIN 2-COL LINKS<BR>
<%loop links_loop%>
<%if first%> <%-- set up the opening table --%>
<TABLE width="100%" cellpadding="2" cellspacing="2" border="0">
<TR>
<%endif%>
<TD>
<a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><b><%Title%></b></a><BR>
<%if Description%>
Description: <%Description%><BR>
<%endif%>
</TD>
<%ifnot row_num % 2%><%-- close the row --%>
</TR><TR><%-- Added an opening TR tag for subsequent rows --%>
<%endif%>
<%if last%> <%-- close the table --%>
<%if row_num % 2 eq 1%><%-- balance the trailing rows --%>
<TD>&nbsp;</TD><%-- Added the non-breaking space for good coding and removed the extra set of TD /TD tags that had been present --%>
<%endif%>
</tr>
</table>
<%endif%>
<%endloop%>
<BR>
END 2-COL LINKS


Thanks so much for pointing out the code snippet.