If you know the ID number of the current file, you can do something like

select top 1 id where id > #currentid# order by id

or something similar depending on the DB to give you the next id. 
Similarly, you could do something like

select top 1 id where id < #currentid# order by id desc

to get the previous id.

-- Ben Doom
    Programmer & General Lackey
    Moonbow Software, Inc.

Paul Giesenhagen wrote:
> Yes, they are coming out of the database and the filename is their ID number
> ...
> 
> Can't hardcode, what if you are on 1003 and 1005(next) is deleted?
> 
> So by using the CFDirectory method,  is it possible to know what place a
> particular file is in (without counting) and then reference the item before
> and after?
> 
> If so, what would the syntax be on this?
> 
> The users will come into the page and view a database driven page that wll
> display short descriptions and thumbnails.
> 
> They click on the thumbnail and it takes them to a page /reports/10032.cfm
> 
>>From their I would like them to navigate without going back and forth
> throughout the whole site.
> 
> Thanks
> Paul Giesenhagen
> QuillDesign
> 
> ----- Original Message ----- 
> From: "Mosh Teitelbaum" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Monday, September 22, 2003 3:19 PM
> Subject: RE: Previous/Next with Files
> 
> 
> 
>>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
>>
>>--
>>Mosh Teitelbaum
>>evoch, LLC
>>Tel: (301) 942-5378
>>Fax: (301) 933-3651
>>Email: [EMAIL PROTECTED]
>>WWW: http://www.evoch.com/
>>
>>
>>
>>>-----Original Message-----
>>>From: Paul Giesenhagen [mailto:[EMAIL PROTECTED]
>>>Sent: Monday, September 22, 2003 4:02 PM
>>>To: CF-Talk
>>>Subject: Previous/Next with Files
>>>
>>>
>>>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:138009
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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to