This is a multi-part message in MIME format.
------=_NextPart_000_0017_01BFFB95.42423F80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Steve,=20
Thanks for the help, unfortuneatly its still not doing what it needs to =
do. What I am trying to do is get the next to bring up the next five =
STATES and what ever manufactures are under that state. This code will =
only bring up the next five actual manufactures when I hit next. Paul =
was gracious enough to send me this template, but unfortuneatly I'm =
rather new at CF, and have a hard time following his logic. I know it =
works well on his page, and some how the next button and the previous =
bottons are turned around, and they will not bring up anything but there =
is no error, nor does any text come up ! It just comes with a blank =
screen.
The template and what I have gotten figured out so far is below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--- Initialize Constants --->
<CFSET MaxClasses =3D 10>
<CFPARAM name=3D"start" DEFAULT=3D"1">
<!--- Query returning search results --->
<CFQUERY name=3D"manf" dataSource=3D"houseboat">
SELECT id, state, company, statename
FROM HBMF
=20
ORDER BY statename
</CFQUERY>
<cfquery name=3D"manf2" datasource=3D"houseboat" >
SELECT ID
FROM HBMF
ORDER BY company
</cfquery>
<!--- Create List of IDs --->
<cfset IDlist =3D ValueList(manf2.ID)>
<cfset ListLength =3D ListLen(IDlist)>
<!--- Create List of Query IDs --->
<cfset QueryList =3D "">
<cfset I =3D 0>
<cfloop query=3D"manf">
<cfset I=3Dmanf.ID>
<cfset QueryList =3D ListAppend(QueryList,I)>
</cfloop>
<!--- Create Empty List --->
<cfset start_list =3D "">
<!--- Create List of Start Row Numbers in Query using ListFind --->
<cfloop index=3D"jndex" list=3D"#IDlist#">
<cfset GetNewsID =3D jndex>
<cfset =
start_list=3DListAppend(start_list,ListFind(QueryList,GetNewsID))>
</cfloop>
<HTML>
<HEAD>
<TITLE>House boat Manufactures/TITLE>
</HEAD>
<CENTER>
<b>Houseboat manufactures, listed by state: </b>
<CFOUTPUT query=3D"manf" GROUP=3D"statename" startrow=3D"#start#" =
maxrows=3D"#MaxClasses#">
<h1><font color=3D"##6600CC"> #statename#</font></h1><Br>
<UL>
<CFOUTPUT><a href=3D"houseboat_brokers3.cfm?id=3D#id#">
<LI><B>#company#</B></A>
</CFOUTPUT>
</UL>
</cfoutput>
<!--- What are the previous and next row to start --->
<CFSET start_position =3D ListFind("#start_list#","#start#")>
<cfset prev_start_position =3D start_position - MaxClasses>
<cfif prev_start_position GT 0>
<cfset PrevStart =3D ListGetAt("#start_list#",#prev_start_position#)>
<cfelse>
<cfset PrevStart =3D 0>
</cfif>
<cfset next_start_position =3D start_position + MaxClasses>
<cfif next_start_position LTE ListLength>
<cfset NextStart =3D ListGetAt("#start_list#",#next_start_position#)>
<cfelse>
<cfset NextStart =3D manf.RecordCount>
</cfif>
<!--- Previous Button Code --->
<CFIF PrevStart GTE 1>
<CFOUTPUT>
<FORM ACTION=3D"manufacturers1.cfm" method=3D"post">
<INPUT type=3D"hidden" NAME=3D"START" VALUE=3D"#PrevStart#">
<INPUT type=3D"submit" value=3D"Next #MaxClasses#">
</FORM>
</CFOUTPUT>
</center>
</CFIF>
<!--- Next Button Code --->
<center>
<CFIF NextStart LT manf.RecordCount>
<CFOUTPUT>
<FORM ACTION=3D"manufacturers1.cfm" method=3D"post">
<INPUT type=3D"hidden" NAME=3D"START" VALUE=3D"#NextStart#">
<INPUT type=3D"submit" value=3D"Previous #MaxClasses#">
</FORM>
</cfoutput>
</center>
</cfif>
</BODY>
</HTML>
Hi Gregg,
>
>
> Paul or whoever can answer me, having a hard time understanding some
of
> this logic. The next botton and previous buttons do not work, and
seem to
> be switched. Any ideas what I am doing wrong ? Here is the code,
thanks.
>
I had a look at the code you gave... It looked a little over complex,
so I
stripped a load of the code out and wound up with this:
<!--- Initialize Constants --->
<CFSET MaxClasses =3D 5>
<CFPARAM name=3D"form.start" default=3D"1">
<CFQUERY name=3D"manf" datasource=3D"houseboat">
SELECT id, state, statename, company
FROM HBMF
Order by statename
</CFQUERY>
<BODY>
<CFOUTPUT query=3D"manf" group=3D"statename" startrow=3D"#form.start#"
maxrows=3D"#MaxClasses#">
<B><FONT size=3D"+1" color=3D"##6600CC">#statename#</FONT></B><BR>
<UL>
<CFOUTPUT>
<LI><A
href=3D"manufacturers3.cfm?id=3D#id#"><B>#company#</B></A>
</CFOUTPUT>
</UL>
</CFOUTPUT>
<!--- Prev Button Code --->
<cfset prevstart =3D start - MaxClasses>
<CENTER>
<CFIF PrevStart GTE 1>
<CFOUTPUT>
<FORM action=3D"manufacturers.cfm" method=3D"post">
<INPUT type=3D"hidden" name=3D"START"
value=3D"#PrevStart#">
<INPUT type=3D"submit" value=3D"Next =
#MaxClasses#">
</FORM>
</CFOUTPUT>
</CFIF>
</CENTER>
<!--- Next Button Code --->
<cfset NextStart =3D Start + MaxClasses>
<CENTER>
<CFIF NextStart LT GetNEWS.RecordCount>
<CFOUTPUT>
<FORM action=3D"index.cfm" method=3D"post">
<INPUT type=3D"hidden" name=3D"START"
value=3D"#NextStart#">
<INPUT type=3D"submit" value=3D"Previous
#MaxClasses#">
</FORM>
</CFOUTPUT>
</CFIF>
</CENTER>
One of the reasons your previous code may not have been working was
because
of the use of the start variable. By not specifying the scope of the
variable and using <cfparam> to check the existance of the variable, you
were probably winding up with a start variable in the 'variables' scope
and
one in the 'form' scope and looking at the 'variables' scope version
rather
than the one passed from the form.
So what I've done is made sure that the start variable is properly
referenced, by using form.start in the cfparam and for any other
references.
Hope this is a little clearer.
Regards
Stephen
Gregg Kachel
Webmaster
www.houseboatmagazine.com
www.houseboat.net
www.pdbworld.com/
------=_NextPart_000_0017_01BFFB95.42423F80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Steve, </FONT></DIV>
<DIV><BR><FONT face=3DArial size=3D2>Thanks for the help, unfortuneatly =
its still=20
not doing what it needs to do. What I am trying to do is get the =
next to=20
bring up the next five STATES and what ever manufactures are under that =
state.=20
This code will only bring up the next five actual manufactures when I =
hit=20
next. Paul was gracious enough to send me this template, but =
unfortuneatly=20
I'm rather new at CF, and have a hard time following his logic. I =
know it=20
works well on his page, and some how the next button and the previous =
bottons=20
are turned around, and they will not bring up anything but there is no =
error,=20
nor does any text come up ! It just comes with a blank =
screen.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>The template and what I have gotten =
figured out so=20
far is below:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><!DOCTYPE HTML PUBLIC "-//W3C//DTD =
HTML 3.2=20
Final//EN"></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- Initialize Constants =
---><BR><CFSET=20
MaxClasses =3D 10><BR><CFPARAM name=3D"start" =
DEFAULT=3D"1"></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- Query returning search results =
---></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><CFQUERY name=3D"manf"=20
dataSource=3D"houseboat"><BR> SELECT id, state, =
company,=20
statename<BR> FROM HBMF<BR> <BR> ORDER BY=20
statename<BR></CFQUERY></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><cfquery name=3D"manf2" =
datasource=3D"houseboat"=20
><BR>SELECT ID<BR>FROM HBMF<BR>ORDER BY=20
company<BR></cfquery></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- Create List of IDs =
---><BR><cfset=20
IDlist =3D ValueList(manf2.ID)><BR><cfset ListLength =3D=20
ListLen(IDlist)></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- Create List of Query IDs=20
---><BR><cfset QueryList =3D ""><BR><cfset I =3D =
0><BR><cfloop=20
query=3D"manf"><BR><cfset I=3Dmanf.ID><BR><cfset QueryList =
=3D=20
ListAppend(QueryList,I)><BR></cfloop></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- Create Empty List =
---><BR><cfset=20
start_list =3D ""></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- Create List of Start Row =
Numbers in Query=20
using ListFind ---><BR><cfloop index=3D"jndex"=20
list=3D"#IDlist#"><BR><cfset GetNewsID =3D jndex><BR><cfset=20
start_list=3DListAppend(start_list,ListFind(QueryList,GetNewsID))><BR>=
</cfloop></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial=20
size=3D2><HTML><BR><HEAD><BR> <TITLE>House boat=20
Manufactures/TITLE><BR></HEAD></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><CENTER></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><b>Houseboat manufactures, listed =
by state:=20
</b></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><CFOUTPUT query=3D"manf" =
GROUP=3D"statename"=20
startrow=3D"#start#" maxrows=3D"#MaxClasses#"></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><h1><font =
color=3D"##6600CC">=20
#statename#</font></h1><Br><BR> =
=20
<UL><BR> <CFOUTPUT><a=20
href=3D"houseboat_brokers3.cfm?id=3D#id#"><BR> =20
<LI><B>#company#</B></A><BR> <=
;/CFOUTPUT><BR> &=
nbsp; =20
</UL><BR> </cfoutput></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- What are the previous and next =
row to=20
start ---><BR><CFSET start_position =3D=20
ListFind("#start_list#","#start#")><BR><cfset prev_start_position =
=3D=20
start_position - MaxClasses><BR><cfif prev_start_position GT=20
0><BR><cfset PrevStart =3D=20
ListGetAt("#start_list#",#prev_start_position#)><BR><cfelse><BR>=
<cfset=20
PrevStart =3D 0><BR></cfif><BR><cfset next_start_position =
=3D=20
start_position + MaxClasses><BR><cfif next_start_position LTE=20
ListLength><BR><cfset NextStart =3D=20
ListGetAt("#start_list#",#next_start_position#)><BR><cfelse><BR>=
<cfset=20
NextStart =3D manf.RecordCount><BR></cfif></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- Previous Button Code =
---></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><CFIF PrevStart GTE=20
1><BR><CFOUTPUT><BR><FORM ACTION=3D"manufacturers1.cfm"=20
method=3D"post"><BR><INPUT type=3D"hidden" NAME=3D"START"=20
VALUE=3D"#PrevStart#"><BR><INPUT type=3D"submit" value=3D"Next=20
#MaxClasses#"><BR></FORM><BR></CFOUTPUT><BR></center>=
;<BR></CFIF></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><!--- Next Button Code=20
---><BR><center><BR><CFIF NextStart LT=20
manf.RecordCount><BR><CFOUTPUT><BR><FORM =
ACTION=3D"manufacturers1.cfm"=20
method=3D"post"><BR><INPUT type=3D"hidden" NAME=3D"START"=20
VALUE=3D"#NextStart#"><BR><INPUT type=3D"submit" value=3D"Previous =
#MaxClasses#"><BR></FORM><BR></cfoutput><BR></center>=
;<BR></cfif></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
size=3D2></BODY><BR></HTML><BR></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Hi Gregg,<BR>><BR>><BR>> =
Paul or=20
whoever can answer me, having a hard time understanding =
some<BR>of<BR>>=20
this logic. The next botton and previous buttons do not work, =
and<BR>seem=20
to<BR>> be switched. Any ideas what I am doing wrong ? Here is =
the=20
code,<BR>thanks.<BR>><BR><BR>I had a look at the code you =
gave... It=20
looked a little over complex,<BR>so I<BR>stripped a load of the code out =
and=20
wound up with this:<BR><BR><!--- Initialize Constants =
---><BR><CFSET=20
MaxClasses =3D 5><BR><CFPARAM name=3D"form.start"=20
default=3D"1"><BR><CFQUERY name=3D"manf"=20
datasource=3D"houseboat"><BR>  =
; SELECT=20
id, state, statename, =
company<BR> FROM=20
HBMF<BR> Order by=20
statename<BR></CFQUERY><BR><BODY><BR><CFOUTPUT =
query=3D"manf"=20
group=3D"statename"=20
startrow=3D"#form.start#"<BR>maxrows=3D"#MaxClasses#"><BR><B><=
;FONT=20
size=3D"+1"=20
color=3D"##6600CC">#statename#</FONT></B><BR><BR>&nb=
sp; =20
<UL><BR>  =
; =20
<CFOUTPUT><BR>  =
; =
=20
<LI><A<BR>href=3D"manufacturers3.cfm?id=3D#id#"><B>#com=
pany#</B></A><BR> &n=
bsp; =20
</CFOUTPUT><BR> =20
</UL><BR></CFOUTPUT><BR><BR><!--- Prev Button Code=20
---><BR><cfset prevstart =3D start -=20
MaxClasses><BR><CENTER><BR><CFIF PrevStart GTE=20
1><BR> =20
<CFOUTPUT><BR>  =
; =20
<FORM action=3D"manufacturers.cfm"=20
method=3D"post"><BR> &n=
bsp; &nb=
sp; =20
<INPUT type=3D"hidden"=20
name=3D"START"<BR>value=3D"#PrevStart#"><BR> &n=
bsp; &nb=
sp; =20
<INPUT type=3D"submit" value=3D"Next=20
#MaxClasses#"><BR> &nbs=
p; =20
</FORM><BR> =20
</CFOUTPUT><BR></CFIF><BR></CENTER><BR><BR><!--- =
Next=20
Button Code ---><BR><cfset NextStart =3D Start +=20
MaxClasses><BR><CENTER><BR> &=
nbsp;=20
<CFIF NextStart LT=20
GetNEWS.RecordCount><BR> &nbs=
p; =20
<CFOUTPUT><BR>  =
; =
=20
<FORM action=3D"index.cfm"=20
method=3D"post"><BR> &n=
bsp; &nb=
sp; =20
<INPUT type=3D"hidden"=20
name=3D"START"<BR>value=3D"#NextStart#"><BR> &n=
bsp; &nb=
sp; &nbs=
p; =20
<INPUT type=3D"submit"=20
value=3D"Previous<BR>#MaxClasses#"><BR> &=
nbsp; &n=
bsp; =20
</FORM><BR> &n=
bsp; =20
</CFOUTPUT><BR> =20
</CFIF><BR></CENTER><BR><BR>One of the reasons your previous =
code=20
may not have been working was<BR>because<BR>of the use of the start=20
variable. By not specifying the scope of the<BR>variable and using =
<cfparam> to check the existance of the variable, you<BR><BR>were =
probably=20
winding up with a start variable in the 'variables' scope<BR>and<BR>one =
in the=20
'form' scope and looking at the 'variables' scope =
version<BR>rather<BR>than the=20
one passed from the form.<BR>So what I've done is made sure that the =
start=20
variable is properly<BR>referenced, by using form.start in the cfparam =
and for=20
any other<BR>references.<BR><BR>Hope this is a little=20
clearer.<BR><BR>Regards<BR><BR>Stephen<BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2>Gregg Kachel<BR>Webmaster<BR><A=20
href=3D"http://www.houseboatmagazine.com">www.houseboatmagazine.com</A><B=
R><A=20
href=3D"http://www.houseboat.net">www.houseboat.net</A><BR><A=20
href=3D"http://www.pdbworld.com/">www.pdbworld.com/</A><BR></FONT></DIV><=
/BODY></HTML>
------=_NextPart_000_0017_01BFFB95.42423F80--
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.