Do your CFDIRECTORY, and then do a QofQ to pull out the next/prev item
(this will get the next item, assuming you're going in filename
order);

<cfquery dbtype="query" name="getNext" maxrows="1">
  SELECT *
  FROM imageList
  WHERE [name] > <cfqueryparam cfsqltype="cf_sql_varchar"
value="#currentName#" />
  ORDER BY [name]
</cfquery>

For previous, make it a < comparison, and add DESC to the ORDER BY
clause.  Just make sure you check to see that there was a record
returned.  If there isn't you'll know you either asked for the image
after the last image, or the image before the first one.

cheers,
barneyb

On 6/23/05, B G <[EMAIL PROTECTED]> wrote:
> I've been noodling around with a photo gallery which relies on Picasa2 to
> create thumbs and web friendly images.  The app use cfdirectory to read the
> list of jpegs in any given directory making it easy to add and delete at
> will without updating the static HTML pages Picasa2 generates.
> 
> It's basic, but works well.  My app is three basic pages.  A page which
> lists folders.  A page which lists thumbnails when the user chooses a
> folder, and of course a page which shows the large image when the user
> clicks on one of the thumbnails.  I've been wanting to add a PREVIOUS - NEXT
> feature on the main image page so the user doesn't have to always hit BACK
> to the thumbs to navigate to the next image.
> 
> I don't see any way of using CFDIRECTORY to determine which file is next
> based on the current position.  I'm guessing that I will have to create a
> list of filenames and keep it in a session so that I can call the filename
> based on list position.  Any other theories?
> 
> Thanks!
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:210440
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to