How about:

 *Add a column, "rowIndex," to the query generated by the cfdir.
 *Populate (with a loop) the new column, "rowIndex," with its
consecutive row number (1, 2, 3, etc.)
 *Cache the query into the app scope, and don't do all the above if
the var already exists.
 *QofQ the new query, and determine the row number by doing a SQL
statement with "SELECT rowIndex FROM yourCfdirName WHERE filename =
'#myCurrentPage#'"
 *get previous with "yourCfdirName[aboveQuery.rowIndex - 1]" << you'll
have to circumvent any errors that would result from a LT 1 array key.
 *get next with "yourCfdirName[aboveQuery.rowIndex + 1]" << you'll
have to circumvent any errors that would result from a too-high key.

First time you cache it, it should be resource-intensive. Subsequent
hits should just need 1 query of the cached query. Not certain if
that's faster or slower than the listfind, though it's surely more
complicated. :)

Jamie

On Mon, 22 Sep 2003 15:01:51 -0500, "Paul Giesenhagen"
<[EMAIL PROTECTED]> wrote:

>I have a directory that can have a small amount or possibly a large amount of files 
>(3,000) files.
>
>Here would be an excerpt of the directory:
>
>10330.cfm
>10331.cfm
>10336.cfm
>10440.cfm
>10441.cfm
>10442.cfm
>10445.cfm etc..
>
>If someone is looking at 10440.cfm, I would like to have two links a link to 
>10336.cfm (previous) and a link to 10441.cfm (next).
>
>I could do a CFdirectory and populate a list with all the file names and then look to 
>the before and after the selected file for the next/previous, but that seems alittle 
>intensive.  
>
>Does anyone have any suggestions on the most efficient way to get next/previous files?
>
>Any help would be appreciated!
>
>Paul Giesenhagen
>QuillDesign
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:138002
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to