Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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!
    3. 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...
    4. Pagination?
      how to pagination by flex?who can help me?
    5. 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....
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139