Help limiting page totals in pagination code
HI ,
I have been trying to limit the output of page totals in my pagination code so I can use it at the top of the page. I grabbed the existing code from a tutorial and it works fine. I tried simply settting a page total variable and outputting , but I do realize it's a little ore compicated than that. Any help will be greatly appreciated.
<div style="padding-top:10px;">
<p> </p>
</div>
<p align="center" class="breadcrumb">
Top of page setting some vars :
<!--- set up pagination --->
<cfset perpage=12>
<cfparam name="url.start" default="1">
<cfif not isNumeric(url.start) or url.start lt 1 or url.start gt qry_prod.recordCount or round(url.start) neq url.start>
<cfset url.start = 1>
</cfif>
<!--- outputting query reslults table rows of product stuff with maxrows set to perpage var--->
<table>
<tr>
<td> ect ...........................
<!--- Here I employ the pageination code , displays at bottom of page --- >
[
<cfif url.start gt 1>
<cfset link = cgi.script_name & "?fuseaction=products&action=cat&id=#url.id#&start=" & (url.start - perpage)>
<cfoutput><a href="#link#">Previous Page</a></cfoutput>
<cfelse>
Previous Page
</cfif>
|
<!--- Start Page Number --->
<cfset pageCount = 1>
<cfset pageLink = 1>
<cfset totalPages = Ceiling(qry_prod.recordCount / perpage)>
<cfloop index="c" from="1" to="#totalPages#">
<cfoutput>
<a href="?fuseaction=products&action=cat&id=#url.id#&start=#pageLink#">#pageCount#</a>
</cfoutput>
<cfset pageCount = pageCount + 1>
<cfset pageLink = pageLink + perpage>
</cfloop>
|
<!--- End Page Number --->
<cfif (url.start + perpage - 1) lt qry_prod.recordCount>
<cfset link = cgi.script_name & "?fuseaction=products&action=cat&id=#url.id#&start=" & (url.start + perpage)>
<cfoutput><a href="#link#">Next Page</a></cfoutput>
<cfelse>
Next Page
</cfif>
]
</p>
Thanks ,
Steve
