
Cliff
Staff

Jul 6, 2005, 10:26 AM
Post #1 of 2
(8879 views)
Shortcut
|
Tutorial : Search results in multiple columns
|
|
|
Hi everyone! I recently setup the search results template to list it's results in two columns for a Priority Consulting project using some old Javascript that I found floating around on the forum. Since I can't seem to find it again, thought that I would post this to the forum so that you can try it out. It's really easy to setup, and if you follow the steps below they will walk you through how to get things going. 1. Add the following counter code somewhere in the <head> tags of the _search_results.html template:
<head> <script language="JavaScript" type="text/javascript"> <!-- var count = 0; --> </script> </head> 2. Move your template insert tag into a table, like this:
<table width="80%" align="center"> <!-- template insert : $list$ --> </table> 3. At the beginning of each template cell, add the following Javascript:
<script> if (count % 2 == 0) { document.write("</tr><tr>"); } count++; </script> The count % 2 == 0 controls the number of column that will be output. You can adjust that to any number you like. Make sure you do this for each templatecell on the page. 4. Then have the rest of the details of the listing in a table column, so the whole template cell looks like this:
<!-- templatecell : row_image --> <script> if (count % 2 == 0) { document.write("</tr><tr>"); } count++; </script> <td valign=top align=center width=115> <!--THE DETAILS OF YOUR LISTING--> </td> <!-- /templatecell : row_image --> And that is pretty much it! Feel free to used the attached template as a reference point if you would like, and if you need any more details about how this works just let me know. Regards, Cliff Stefanuk - Customer Service Manager [email]support@interactivetools.com[/email]
(This post was edited by Cliff on Jul 6, 2005, 10:28 AM)
|