[thelist] Cold Fusion -- looping records in 3 columns

rudy r937 at interlog.com
Sat Mar 1 06:50:01 CST 2003


this is gorgeous

a form that posts the number of columns back to itself

the code was a bit tricky for me to understand
(good thing you kept it simple, eh)

a "checkpoints" array determines when to start a new column --

  <cfif currentrow GT (recordcount * col / form.columns)
        AND NOT checkpoints[col]>
    <div style="float: left; padding: 5px; width: #width#;">
    <cfset checkpoints[col] = "1">
    <cfset col = col + "1">

columns are divs, not tables or table cells

very nice job, joshua


this is even gorgeouser

right off the bat, a structure
(i'm in deep water already, eh)

  <table border="0" width="100%">
  <cfloop from="#url.startrow#"
      to="#Val(url.startrow + paged_column_output.rows - 1)#"
    <cfloop from="1"
    <cfif paged_column_output.column GT 1>
      <cfset paged_column_output.currentrow =
         (paged_column_output.rows *
           (paged_column_output.column - 1))
        + paged_column_output.row>

maybe it's me but the long structure name really gets in the way

still, i really like how the query result set is just another of
the elements in the structure

that's beautiful

that means your code can concentrate on row and column logic

which means you could make it portable, like a function or something

plug it in wherever you need columnar output

the possibilities are endless...

also, incorporating a paging variable, url.startrow, is cool

you guys have both done a great job

thanks for sharing your code

i don't know which one to steal

jeff, the way your code box is styled gave me a shiver

it reminded me of an editor i once had a terrifying experience with

cfstudio, i think it was called


More information about the thelist mailing list