Problem with Next Page functionality
i have page combines 2 queries , outputs results.
i have built in next page facility shows x amount per page, seems work ok, have 1 slight problem.
i have 16 results in query should show 4 pages 4 records on each page, yet shows link 5th page, when click on 5th page there no record (as there 16 records).
you can view page using link
http://www.i-webs.co.uk/mosaic/next_page.cfm?pageindex=0&dir_id=24&brand_id=4
here code
----
i have built in next page facility shows x amount per page, seems work ok, have 1 slight problem.
i have 16 results in query should show 4 pages 4 records on each page, yet shows link 5th page, when click on 5th page there no record (as there 16 records).
you can view page using link
http://www.i-webs.co.uk/mosaic/next_page.cfm?pageindex=0&dir_id=24&brand_id=4
here code
----
hi craig,
have tried starting page index 1 instead of page index 0? let's try changing line 31
<cfparam name="url.pageindex" default="1">
and changing line 70
<cfloop index="pages" from="1" to="#totalpages#">
and see if helps. also, heads-up on line 35: you're using regular division operator, give decimal there's not number of records. e.g., 15 hits / 4 hits-per-page = 3.75. can use integer division operator (back slash) instead 15 hits \ 4 hits-per-page = 3.
of course, you'd have compensate lost fraction adding page @ end, if there's lost decimal. lost decimal can checked using mod. use starting on line 34:
<cfset recordsperpage = 4>
<cfset hitremainder = getdetails.recordcount mod recordsperpage>
<cfset totalpages = (getdetails.recordcount \ recordsperpage) + sgn(hitremainder)>
...
...
let me know how goes.
dave justin
have tried starting page index 1 instead of page index 0? let's try changing line 31
<cfparam name="url.pageindex" default="1">
and changing line 70
<cfloop index="pages" from="1" to="#totalpages#">
and see if helps. also, heads-up on line 35: you're using regular division operator, give decimal there's not number of records. e.g., 15 hits / 4 hits-per-page = 3.75. can use integer division operator (back slash) instead 15 hits \ 4 hits-per-page = 3.
of course, you'd have compensate lost fraction adding page @ end, if there's lost decimal. lost decimal can checked using mod. use starting on line 34:
<cfset recordsperpage = 4>
<cfset hitremainder = getdetails.recordcount mod recordsperpage>
<cfset totalpages = (getdetails.recordcount \ recordsperpage) + sgn(hitremainder)>
...
...
let me know how goes.
dave justin
More discussions in ColdFusion
adobe
Comments
Post a Comment