[I only posted to the newsgroup the first time...]

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 16:19:25 -0400, in cf-talk you wrote:

>Paul:
>
>It might help to take a step back and determine how people will come to this
>page in the first place.  perhaps you can use the same mechanism that
>provides the link to this page to determine the previous/next pages.
>
>Do these files have entries in a database?  You could then use some sort of
>query to determine previous/next (although this may be more intensive than
>using CFDIRECTORY).
>
>Do you ever add new files?  If not, consider hard coding the references to
>previous/next files.
>
>Are the files/pages heavily traversed?  If so, it may make sense to cache
>the whole directory listing in the APPLICATION scope and read from the cache
>to dynamically create the previous/next links at each page request.
>
>HTH

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:138003
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

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to