|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have created a master page that is for my picture gallery I am using the
thumbnail as a link to my detail page. On my detail page I am showing a full-size image of the thumbnail. I am trying to setup a previous and next button that are dynamic with my database I went to Recordset paging and used Next and Previous but it does not work. I must be missing something can somebody please give me some assistance. Thanks in advance for the help. |
|
#2
|
|||
|
|||
|
Quote:
|
|
#3
|
|||
|
|||
|
Sorry about that. When I said it does not work I mean that the next and previous link I create does not work. If you click either next or previous it stays on the same image you are on that was passed through the master page. Here is a link to that page www.tuscanstonemantels.com/gallery.cfm
then click on any image it will take you to the detail page. Thanks for such a quick response. Hope this was useful. |
|
#4
|
|||
|
|||
|
Well the problem is that your next and previous links are the same as the current page, that is, they aren't pointing to different images via the url variable "tuscan". So you need to have a query or something run and use the result(s) of the query to feed different image names to the tuscan url variable.
|
|
#5
|
|||
|
|||
|
Can you give pointers or direction where I could find out what query I should run. A little new to the CF game.
|
|
#6
|
|||
|
|||
|
Well now you're asking about SQL which is specific to your database and your table structure. One way to do it would be to assign a sequential ID to each image, and then since you know the current image ID (say it is 5) you can query for the next highest and lowest record IDs to use in your next and previous buttons.
|
|
#7
|
|||
|
|||
|
MS Access Database
I've have gone through a lot of different technotes as well as tutorials but still no success. I am going to need help from somebody that can give me some coding assistance. Here is a link to my master page just click any picture it will take you to my detail page. Thanks for any help given....
http://www.tuscanstonemantels.com/gallery.cfm |
|
#8
|
|||
|
|||
|
Here's some sample code I whipped up:
Code:
<cfparam name="url.currentImageID" default="1" />
<cfset myBaseQuery = queryNew('imageID,imageName') />
<cfset queryAddRow(myBaseQuery) />
<cfset querySetCell(myBaseQuery,'imageID',1) />
<cfset querySetCell(myBaseQuery,'imageName','image1.jpg') />
<cfset queryAddRow(myBaseQuery) />
<cfset querySetCell(myBaseQuery,'imageID',4) />
<cfset querySetCell(myBaseQuery,'imageName','image19.jpg') />
<cfset queryAddRow(myBaseQuery) />
<cfset querySetCell(myBaseQuery,'imageID',9) />
<cfset querySetCell(myBaseQuery,'imageName','image44.jpg') />
<cfset queryAddRow(myBaseQuery) />
<cfset querySetCell(myBaseQuery,'imageID',12) />
<cfset querySetCell(myBaseQuery,'imageName','image6.jpg') />
<cfquery name="getCurrentImageInfo" dbtype="query">
select imageID, imageName from myBaseQuery
where imageID = #url.currentImageID#
</cfquery>
<cfquery name="getPriorImageID" dbtype="query">
select max(imageID) as imageID from myBaseQuery
where imageID < #url.currentImageID#
</cfquery>
<cfquery name="getNextImageID" dbtype="query">
select min(imageID) as imageID from myBaseQuery
where imageID > #url.currentImageID#
</cfquery>
<cfoutput>
The current image is ID #getCurrentImageInfo.imageID# and name #getCurrentImageInfo.imageName#<br />
<cfif getPriorImageID.recordCount><a href="#cgi.script_name#?currentImageID=#getPriorImageID.imageID#">Previous</a></cfif><br />
<cfif getNextImageID.recordCount><a href="#cgi.script_name#?currentImageID=#getNextImageID.imageID#">Next</a></cfif>
</cfoutput>
|
|
#9
|
|||
|
|||
|
Kiteless thanks for the code but I am still a little to green maybe you can break it down a little more for me. I am extremely sorry to keep bothering you but I am really trying to get this concept.
I was just going over my page and I am noticing that the detailed.cfm page is only pulling (1) record so do I need to create another recordset on that page because the URL is being pushed through from the (Master) page gallery.cfm. Like I said I am real green but it sounded like it might be a way to scroll through all of my records Quote:
|
|
#10
|
|||
|
|||
|
Yes you'd want three queries, one for the currently displayed item information, one to determine the previous image, and one to determine the next image. Note that all of this hinges on using a numeric ID field in the database so that you can determine which ID's are before and which are after the current item.
|
|
#11
|
|||
|
|||
|
I do have an autoid field it is itemid. Now I pass a url from my gallery.cfm page over to my detailed.cfm. I am using this string ?tuscan=#web.LocationFull# so when they click on my thumbnail it retreives data from my database and displays the larger image of the thumbnail. Which I am sure that was nothing you did not already know. My question now is that when it is on my detailed.cfm page that particular string in the browser is: http://www.tuscanstonemantels.com/Detailed.cfm?tuscan=/images/full/image01.jpg which is only (1) item being returned from the database not the entire database. I said all of that to say this will the code you created above work for my application if I change the necessary field names.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Detailed page - navigation - next - previous HELP!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|