I use the following for our website.

<cfset max= round(news.recordcount / 2)>
<cfset row2 = max + 1>

<table cellpadding="2" cellspacing="0" border="0">
    <td valign="top"><table cellpadding="2" cellspacing="0" border="0">
             <cfoutput query="news" startrow="1" maxrows="#max#">
                  <tr><td>Column1 Results</td></tr>
             </cfoutput>
            </table>
      </td>
      <td width="5">&nbsp;</td>
      <td valign="top"><table cellpadding="2" cellspacing="0" border="0">
           <cfoutput query="news" startrow="#row2#" maxrows="#max#">
                <tr><td>Column2 Results</td></tr>
           </cfoutput>
          </table>
     </td></tr>
</table>

Thanks,
Dan

  ----- Original Message -----
  From: [EMAIL PROTECTED]
  To: CF-Talk
  Sent: Monday, August 09, 2004 10:40 AM
  Subject: RE: Output in 2 columns

  >> How to "divide" that news in 2 columns, like this:

  Again, if I understanding you right.... (not tested this code but it's
  thereabouts)

  <cfset noNews = news.recordCount />
  <cfset halfNews = int(news.recordCount/2) />

  <div id="news">
  <cfoutput query="news">
      <cfif news.currentRow eq 1>
          <div id="news-left"
      </cfif>

      #news.item#<br />

      <!--- Output halfway news div's --->
      <cfif news.currentRow eq halfNews>
          </div>

          <div id="news-right">
      </cfif>

      <!--- Close off div if last record --->
      <cfif news.currentRow eq news.recordCount>
          </div>
      </cfif>
  </cfoutput>
  </div>

  --
  dc
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to