freelanceprogrammers.org Forum Index » Cold Fusion
pagination script
Joined: 01 Apr 2005
Posts: 16
pagination script
Hi all,
I`ve been searching the web to find either a script or a tutorial (that
would show me how to create the script) for a simple pagination system like
this:
previous 1|2|3|4|5|6 next
If found a few custom tags and some discussions in specific issues of
pagination scripts, but I could not find either a free script to use (I
don`t want a custom tag) or a specific tutorial that would teach me how to
do it myself.
Any pointers/ideas on where to find this?
Thanks,
Roberto Perez
rgpg@...
Joined: 01 Apr 2005
Posts: 16
pagination script
At 07:58 AM 4/2/05, you wrote:
>Here`s one:
>http://www.macromedia.com/cfusion/exchange/index.cfm#loc=en_us&view=sn106&viewN
ame=Exchange%20Search%20Details&authorid=34590699&page=0&scrollPos=0&subcatid=0&
snid=sn106&itemnumber=7&extid=1009820&catid=0
Thanks for the link. I was not sure what else to call this procedure to do
a better search (you mentioned "Next N" as an alternative).
In the meantime, I came across a simple, free script from
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=14&lngWId=9,
which I`m pasting at the end of the message.
There`s a modification I`ve tried unsuccessfully: to insert a drop down
menu so that the user can choose the number of records per page
(#OnEachPage#) instead of the default "8" set for "OnEachPage".
Any suggested ways to modify the script to achieve that?
Thanks a lot,
Roberto Perez
rgpg@...
- - - - - - - script starts here - - - - - - - - - -
<CFQUERY DATASOURCE = "gallery" NAME = "list">
SELECT State FROM States
ORDER BY State
</CFQUERY>
<!--- Set the number of records to display on each page. --->
<CFSET OnEachPage = 8>
<!--- Set the default startrow to 1 if a value was not passed. --->
<!--- Determine whether or not to show the previous or next links. --->
<CFPARAM NAME = "StartRow" DEFAULT = "1">
<!--- Set the value of endrow to the maxrows + startrow - 1 --->
<CFSET EndRow = StartRow + OnEachPage - 1>
<!--- If the end row is greater than the recordcount, determine how many
records are left. --->
<CFIF EndRow GTE list.RecordCount>
<CFSET EndRow = list.RecordCount>
<CFSET Next = false>
<!--- Othereise, set Next to true and determine the next set of records. --->
<CFELSE>
<CFSET Next = true>
<CFIF EndRow + OnEachPage GT list.RecordCount>
<CFSET NextNum = list.RecordCount - EndRow>
<CFELSE>
<CFSET NextNum = OnEachPage>
</CFIF>
<CFSET NextStart = EndRow + 1>
</CFIF>
<!--- If StartRow is 1, set Previous to false. --->
<CFIF StartRow IS 1>
<CFSET Previous = false>
<!--- Othewise, determine the previous set of records. --->
<CFELSE>
<CFSET Previous = true>
<CFSET PreviousStart = StartRow - OnEachPage>
</CFIF>
<!--- Determine how many pages will be displayed. --->
<CFSET NumPages = Ceiling(list.RecordCount / OnEachPage)>
<CFPARAM NAME = "PageNum" DEFAULT = "1">
<HTML><HEAD><TITLE>ColdFusion Previous / Next</TITLE></HEAD>
<BODY BGCOLOR = "#ffffff">
<CFOUTPUT>
Now displaying records #StartRow# to #EndRow# of #list.RecordCount#.<P>
</CFOUTPUT>
<TABLE BORDER = "0">
<TR><TD VALIGN = "top">
<!--- If Previous is true, display the previous link. --->
<CFIF Previous>
<CFOUTPUT>
<A HREF =
"CFPreviousNext.cfm?StartRow=#PreviousStart#&PageNum=#DecrementValue(PageNum)#">
<< Previous</A>
</CFOUTPUT>
<CFELSE>
</CFIF>
</TD>
<CFLOOP FROM = "1" TO = "#NumPages#" INDEX = "ThisPage">
<CFOUTPUT>
<CFIF ThisPage IS PageNum>
<TD>#ThisPage#</TD>
<CFELSE>
<CFSET PageNumStart = (((ThisPage - 1) *
OnEachPage) + 1)>
<TD><A HREF =
"CFPreviousNext.cfm?StartRow=#PageNumStart#&PageNum=#ThisPage#">
#ThisPage#</A></TD>
</CFIF>
</CFOUTPUT>
</CFLOOP>
<TD VALIGN = "top">
<!--- If Next is true, display the previous link. --->
<CFIF Next>
<CFOUTPUT>
<A HREF =
"CFPreviousNext.cfm?StartRow=#NextStart#&PageNum=#IncrementValue(PageNum)#">
Next >></A>
</CFOUTPUT>
<CFELSE>
</CFIF>
</TD>
</TR>
<TR><TD VALIGN = "top" COLSPAN = "<CFOUTPUT>#Evaluate(NumPages +
2)#</CFOUTPUT>">
<CFOUTPUT QUERY = "list" STARTROW = "#startrow#" MAXROWS =
"#OnEachPage#">
#State#<BR>
</CFOUTPUT>
</TD>
</TR>
<TR>
</TABLE>
</BODY>
</HTML>
- - - - - - - - - - script ends here - - - - - - - - - -
Joined: 02 Apr 2005
Posts: 20
pagination script
Try searching Google for a "Next n" script, that is another name used
commonly.
Mark Gregory
----- Original Message -----
From: "Roberto Perez" <rgpg@...>
To: <cold_fusion@yahoogroups.com>
Sent: Friday, April 01, 2005 12:45 AM
Subject: [cold_fusion] pagination script
>
> Hi all,
>
> I`ve been searching the web to find either a script or a tutorial (that
> would show me how to create the script) for a simple pagination system
like
> this:
>
> previous 1|2|3|4|5|6 next
>
>
> If found a few custom tags and some discussions in specific issues of
> pagination scripts, but I could not find either a free script to use (I
> don`t want a custom tag) or a specific tutorial that would teach me how to
> do it myself.
>
> Any pointers/ideas on where to find this?
>
> Thanks,
>
> Roberto Perez
> rgpg@...
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
Joined: 02 Apr 2005
Posts: 20
pagination script
Here`s one:
http://www.macromedia.com/cfusion/exchange/index.cfm#loc=en_us&view=sn106&viewNa
me=Exchange%20Search%20Details&authorid=34590699&page=0&scrollPos=0&subcatid=0&s
nid=sn106&itemnumber=7&extid=1009820&catid=0
Mark Gregory
----- Original Message -----
From: "Roberto Perez" <rgpg@...>
To: <cold_fusion@yahoogroups.com>
Sent: Friday, April 01, 2005 12:45 AM
Subject: [cold_fusion] pagination script
>
> Hi all,
>
> I`ve been searching the web to find either a script or a tutorial (that
> would show me how to create the script) for a simple pagination system
like
> this:
>
> previous 1|2|3|4|5|6 next
>
>
> If found a few custom tags and some discussions in specific issues of
> pagination scripts, but I could not find either a free script to use (I
> don`t want a custom tag) or a specific tutorial that would teach me how to
> do it myself.
>
> Any pointers/ideas on where to find this?
>
> Thanks,
>
> Roberto Perez
> rgpg@...
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







