Advertisement

09.18.2008 at 02:07PM PDT, ID: 23744014
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Next N Function - Paging

Asked by jturkington in Cold Fusion Markup Language, ColdFusion Application Server

Tags:

Having a few issues trying to get my paging solution a little sleaker. What i am trying to accomplish is making the page links display 5 links left and right of the currently viewed page link eg..

<< 5 6 7 8 9 [10] 11 12 13 14 15 >>

Blow is my current NEXTN function which i use: -
<!--- Next-N() method --->
<cffunction name="nextN"
      displayname="Next-N Method"
      hint="Returns a structure containing row (next/back/end/totalrows)"
      access="public"
      returntype="struct"
      output="false">
                        
      <cfargument name="rowsPerPage" type="numeric" required="no" default="10">
      <cfargument name="startRow" type="numeric" required="no" default="1">
      <cfargument name="qryRecordCount" type="numeric" required="yes">
      <cfargument name="cgiRequestMethod" type="string" required="yes">
            
      <!--- Setup nextN structure --->
      <cfset var nextN = structnew()>
            
      <!--- Setup rowsPerPage Default --->
      <cfset nextN.rowsPerPage = arguments.rowsPerPage>
            
      <!--- What row to start at? Assume first by default --->
      <cfset nextN.startRow = arguments.startRow>
            
      <!--- If form is posted set start row to 1 --->
      <cfif NOT CompareNoCase(arguments.cgiRequestMethod,"post")>
                  <cfset nextN.startRow = 1>
      </cfif>
            
      <!--- We know the total number of rows from query --->
      <cfset nextN.totalRows = arguments.qryRecordCount>
            
      <!--- Last row is 10 rows past the starting row, or total number of query rows, whichever is less --->
      <cfset nextN.endRow = Min(nextN.startRow + nextN.rowsPerPage - 1, nextN.totalRows)>
            
      <!--- Next button goes to 1 past current end row  --->
      <cfset nextN.startRowNext = nextN.endRow + 1>
            
      <!--- Back button goes back N rows from start row --->
      <cfset nextN.startRowBack = nextN.startRow - nextN.rowsPerPage>

      <cfreturn nextN>
</cffunction>

Example of current page links: -
<!--- Pagination --->
<div class="pagination">
        <cfoutput>
            <!--- Simple "Page" counter, starting at first "Page" --->
            <cfset ThisPage = 1>
            Page
           
            <!--- Back button --->
            <cfif nextN.startRowBack GT 0>
                <a href="#cgi.script_name#?startrow=#nextN.startRowBack#&orderby=#url.orderBy#&order=#url.order#&#variables.urlString#" title="Back #nextN.rowsPerPage# records" tabindex="7">
                    <span>&laquo;</span>
                </a>
            </cfif>
           
            <!--- Loop thru row numbers, in increments of RowsPerPage --->
            <cfloop from="1" to="#nextN.totalRows#" step="#nextN.rowsPerPage#" index="pageRow">
                <!--- Detect whether this "Page" currently being viewed --->
                <cfset IsCurrentPage = (pageRow gte nextN.startRow) AND (pageRow lte nextN.endRow)>
         
                <!--- If this "Page" is current page, show without link --->
                <cfif IsCurrentPage>
                    <b>#thisPage#</b>  
                <cfelse>
                    <!--- Otherwise, show with link so user can go to page  --->  
                    <a href="#cgi.script_name#?startrow=#pageRow#&orderby=#url.orderBy#&order=#url.order#&#variables.urlString#" tabindex="6">#thisPage#</a>  
                </cfif>
               
                <!--- Increment ThisPage variable --->
                <cfset thisPage = thisPage + 1>
            </cfloop>
           
             <!--- Next button --->
            <cfif nextN.startRowNext LTE nextN.totalRows>
                <a href="#cgi.script_name#?startrow=#nextN.startRowNext#&orderby=#url.orderBy#&order=#url.order#&#variables.urlString#" title="Next #nextN.rowsPerPage# records" tabindex="8">
                    <span>&raquo;</span>
                </a>
            </cfif>
        </cfoutput>      
    </div>

Thanks

JonathanStart Free Trial
 
Loading Advertisement...
 
[+][-]09.19.2008 at 10:41AM PDT, ID: 22523563

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 01:05PM PDT, ID: 22524992

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 01:13PM PDT, ID: 22525083

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.21.2008 at 05:39AM PDT, ID: 22534200

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.21.2008 at 09:37AM PDT, ID: 22535215

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Cold Fusion Markup Language, ColdFusion Application Server
Tags: coldfusion
Sign Up Now!
Solution Provided By: gdemaria
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.21.2008 at 09:41AM PDT, ID: 22535224

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.24.2008 at 01:20AM PDT, ID: 22557721

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628