[thesite] Tip Harvest: Prev / Next Tip

rudy r937 at interlog.com
Thu Sep 27 14:48:34 CDT 2001

>Interesting.  Still running a query against the database though...

what do you mean "still" running?  

when you run the query to get the tip details, i'm suggesting just 
use that query to get the prev/next for display under that tip's details

>But I'll trust you when you say it's efficient.  :)

efficient is relative

i always pass the buck on that kinda concern to the dba anyway...    ;o)

> I'm not a CF person so I don't know what methods are
> available to pass this data around and what is the most efficient way.  

fair enough

i'd be inclined to use a cached query (shhhh, we might wake jeff up)

but think about how you produced the summary list 

you ran a query for that month, right?

   [  or else i guess i don't know where 
      your data is coming from -- i just assumed 
      that everything is in the tips table(s)...      ]

and when you click on one of those column headings, 
this attaches a query string to the url, orderby=xxxxx

i'm assuming this simply re-runs the query that produces the
summary list, just using a different order by clause

> My initial thought is just to pass it all as part of the URL 
> since the links from the summary to the detail pass
> all of the parameters. Something like:
>   tip_detail.cfm?tip_id=3343&tip_list=3,3343,1,4423,410
> and parse that in the CF template to get 3 and 1 for the prev and next
> tip_id, respectively.  Of course, the URL may get too long and break
> the whole thing.

pass the entire summary list?  yeah, you're right, it's too big

pass only prev/next?  that won't work, cause after the first page,
how do you know what the next tip id is?

(b.t.w. what's the 410 for?)

thus, your quest for "passing" the entire summary list

you could do it if they were stored in some persistent way in cold fusion

application session variable?   cached query?

we've had this discussion before, it's one of my favourite threads [but 
maybe only because it's so easy for me to forget things at my age...]

however, setting up application variables or a cached query is 
probably more code than you want to get involved with right now

my suggestion lets you go from detail page to detail page following
prev and next links without "passing" any of them

but there is yet more complexity in a proper prev/next implementation

you also need to know when you are sitting on the first or the last,
so that you can "gray out" those links

if you store the list in memory, you would need a way to
traverse it in one of three sequences -- because obviously
you do not want everybody who hits that page to force a re-sort
of application variables....  as i understand it, you could do a 
query of a query in cf 5 around this problem, but that seems
way too complex for me

the additional first/last complexity in using sql is that
when you are sitting on the first or last, you will have nulls in those
columns...  i think, i mean, if i coded them right, i just did
them off the top of my head...

please let me know if this is not clear

i can barely understand it myself


More information about the thesite mailing list