Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

previous/next function, variable passed from url - how?

Status
Not open for further replies.

asanti

Technical User
Joined
Feb 22, 2002
Messages
3
Location
NL
Hello,

I've got this image gallery that passes the value of the image to display to the URL of a spawned window (with me so far?).

<href=&quot;javascript:launch('zoom.cfm?fullPic=image.gif');&quot;>

Zoom.cfm displays the image just fine...

<IMG SRC=&quot;full/#URL.fullPic#&quot;>

But I want to add previous/next picture functionality to the spawned window. The gallery index displays the images in chronological order and I'd like to maintain this sequence in the zoomed window.

How...? Desperate...
 
Here is a routine I think I picked up from someone on this forum awhile back:



START OF CODE

<cfparam name=&quot;startrow&quot; default=&quot;1&quot;>
<cfparam name=&quot;maxrows&quot; default=&quot;10&quot;>
<cfoutput query=&quot;yourqueryname&quot; maxrows=&quot;#maxrows#&quot; startrow=&quot;#startrow#&quot;>

DISPLAY YOUR OUTPUT FOR FIRST BATCH OF ROWS HERE

</cfoutput>
<cfoutput>
<cfif startrow GTE maxrows>
<cfset startrow1 = #startrow# - maxrows>
<input type=&quot;Button&quot; value=&quot;<< Previous Group&quot; onclick=&quot;window.location='thispage.cfm?startrow=#startrow1#'&quot;>
</cfif>
<cfset startrow = #startrow# + maxrows>
<cfif #yourqueryname.recordcount# GTE startrow>
<input type=&quot;Button&quot; value=&quot;Next Group >>&quot; onclick=&quot;window.location='thispage.cfm?startrow=#startrow#'&quot;>
</cfif>
</cfoutput>

END OF CODE

Hope this helps The only dumb questions are the ones that are never asked
 
Thanks, but I've got that part of the gallery working. It's in the spawned window -- where I'm only showing one image (by choice) -- that I want to add the next/previous functionality. What I'm having difficulty with is the variable that's passed to the URL -- how to take that into account when setting the sequence for the next/previous function.
 
Sorry for the confusion....


pass the variable as a #url.variable#.

then the next/previous function should look something like this:

<input type=&quot;Button&quot; value=&quot;Next Group >>&quot; onclick=&quot;window.location='thispage.cfm?startrow=#startrow#&variable=#url.variable#'&quot;> The only dumb questions are the ones that are never asked
 
Hi. Thanks for your help. I'm a real CF newbie so I'm not sure if I just didn't understand what you were trying to tell me but I couldn't get it to work. I did manage to kludge something together that works:

<!--- Read Picture List --->
<CFHTTP Method=&quot;GET&quot;
URL=&quot; NAME=&quot;picZoom&quot;
COLUMNS=&quot;fName&quot;
DELIMITER=&quot;&quot;
TEXTQUALIFIER=&quot;&quot;>

<!--- Set to Array --->
<cfset snuh=arraynew(1)>
<cfset count = 1>

<CFLOOP query=&quot;picZoom&quot;>
<CFSET snuh[count] = '#picZoom.fname#'>
<CFSET count = count + 1>
</CFLOOP>

<!--- Assign the rowNow variable --->
<cfoutput query=&quot;picZoom&quot;>
<cfif #fname# EQ #url.fullpic#>
<cfset rowNow = #currentrow#>
</cfif>
</cfoutput>


<!--- Display --->
<table width=&quot;100%&quot; height=&quot;90%&quot; border=&quot;1&quot; cellspacing=&quot;10&quot; cellpadding=&quot;10&quot; bordercolor=&quot;#000000&quot; style=&quot;border: 0px none Black;&quot;>
<CFOUTPUT>
<tr>
<td ALIGN=&quot;CENTER&quot; bgcolor=&quot;##34568D&quot;><IMG SRC=&quot;full/#snuh[rowNow]#&quot;></td>
</tr>
</CFOUTPUT>
</table>
<div align=&quot;center&quot;>
<cfoutput>
<cfif #rowNow# GT 1>
<a href=&quot;picPage.cfm?FullPic=#snuh[rowNow - 1]#&quot;>previous</a>
</cfif>
</cfoutput>
<cfoutput>
<cfif #rowNow# LT #picZoom.recordCount#>
<a href=&quot;picPage.cfm?FullPic=#snuh[rowNow + 1]#&quot;>next</a>
</cfif>
</cfoutput>
</div>

Like I said, I'm a real CF newbie so I'm sure there's a correct way of doing this that's just beyond me right now. At the very least, something more elegant. If anyone out there can straighten me out it would be greatly appreciated.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top