Ask a Question related to Macromedia ColdFusion, Design and Development.
-
G_Park #1
Pagination Script
Hi,
I'm total newbie when it comes to ColdFusion, but learning all the time!!
Well I need to learn in my case :)
Anyway, I'm trying construct a prev and next functionality on my site, I know
this is a hot topic on this subject, but can anyone point me in the right
direction of example scripts using CF?
Many Thanks
Oz.
G_Park Guest
-
Book Pagination (.indb) Continuous Pagination (HELP!)
THE DOCUMENT: I've been working on a book with 14 separate documents using the Book feature (.indb) which coordinates the separate chapters... -
Pagination
Hi! I would like to know if there is anyway we could paginate a document with Acrobat 6.0.2 Professional. Thanks a lot! -
Pagination help?
Looking for advice on the best way to do this: We're a daily newspaper with 8 page editors doing layout all at once — each editor has 5-7 pages... -
Pagination?
how to pagination by flex?who can help me? -
Pagination with CF
Hi, I am creating an online magazine. So whenever I call an article out from my MS Access Database, it will display about 1000 characters of text.... -
casagrande8289 #2
Re: Pagination Script
hello, before starting i am suspecting that you are using a cfoutput tag with a
query attribute to display data from a database.
In order to allow pageable records with previous and next links, you want to
make a few variables (NextRow and LastRow). Then set valu es to these
variables....lets just describe it in the code:
<!---sets default value for startpage to avoid errors--- >
<cfparam name="URL.startrow" default="1" />
<!---sets values for links to view previous and next--- >
<cfset NextRow = URL.startrow+10 />
<cfset LastRow = URL.startrow-10 />
<!---then the links--- >
<a href="#CGI.SCRIPT_NAME#?startrow=#LastRow#>previou s 10</a>
<a href="#CGI.SCRIPT_NAME#?startrow=#NextRow#>next 10</a>
<!---then the simple part....the cfoutput tag--- >
<cfoutput query="your_query" startrow="#URL.startrow#" maxrows="10">
#your_query.examplecolumn#......#your_query.anothe rexamplecolumn#<BR>
</cfoutput>
Hope that was what you were looking for....
<!---sets default value for startpage to avoid errors--- >
<cfparam name="URL.startrow" default="1" />
<!---sets values for links to view previous and next--- >
<cfset NextRow = URL.startrow+10 />
<cfset LastRow = URL.startrow-10 />
<!---then the links--- >
<a href="#CGI.SCRIPT_NAME#?startrow=#LastRow#>previou s 10</a>
<a href="#CGI.SCRIPT_NAME#?startrow=#NextRow#>next 10</a>
<!---then the simple part....the cfoutput tag--- >
<cfoutput query="your_query" startrow="#URL.startrow#" maxrows="10">
#your_query.examplecolumn#......#your_query.anothe rexamplecolumn#<BR>
</cfoutput>
casagrande8289 Guest
-
G_Park #3
Re: Pagination Script
Thanks casagrande8289,
Yeah I was looking for something similar to what you have given.
I'll give that a go, and get back to you, no doubt I will though!!
G_Park Guest
-
jdeline #4
Re: Pagination Script
There are a number of ways this can be done. The code below shows one version.
This template has the filename showStuff.cfm. I have not included code to
handle start greater than getQuery.RecordCount or start less than zero. I'll
leave that up to you.
<CFPARAM NAME="count" DEFAULT="20">
<CFPARAM NAME="start" DEFAULT="1">
<CFQUERY NAME="getStuff" DATASOURCE="myData">
SELECT name, address FROM myTable WHERE ....
</CFQUERY>
<CFOUTPUT QUERY="getStuff" STARTROW="#start#" MAXROWS="#count#">
#name# #address#<BR>
</CFOUTPUT>
<CFSET nextStart = start + count>
<CFSET prevStart = start - count>
<CFOUTPUT>
<FORM ACTION="showStuff.cfm">
<A HREF="showStuff.cfm?start=#nextStart">Next</A>
<A HREF="showStuff.cfm?start=#prevStart">Previous</A>
</FORM>
</CFOUTPUT>
jdeline Guest



Reply With Quote

