Skip to content

stevemo/pagination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Pagination Component for Coldfusion

Config variables

  • currentPage
  • perPage
  • totalItems
  • baseUrl
  • numLinks

Template variables

  • wrapperStart
  • wrapperEnd
  • pageStart
  • pageEnd
  • previousStart
  • previousEnd
  • previousMark
  • nextStart
  • nextEnd
  • nextMark
  • activeStart
  • activeEnd

Public Function

init

optional argument

  • config type struct
  • template type struct

setConfig

required argument

  • config type struct

setTemplate

required argument

  • Template type struct

setPagination

required argument

  • perPage type numeric
  • currentPage type numeric
  • totalItems type numeric

createLinks

getOffset

getPerPage

Usage

<cfparam name="currentPage" default="0"> <cfif structKeyExists(url,'page')> <cfset currentPage = url.page> </cfif> <cfquery name="qCount" dataSource="myBlog"> SELECT COUNT(*) AS count FROM blog </cfquery> <cfset config = structNew() > <cfset config.currentPage = variables.currentPage > <cfset config.totalItems = qCount.count > <cfset config.baseUrl = '#CGI.SCRIPT_NAME#?page=' > <cfset obj = createObject('component','pagination').init(config)> or use <cfset obj = createObject('component','pagination').setPagination(2,variables.currentPage,qCount.count)> <cfquery name="posts" dataSource="myBlog"> SELECT * FROM blog LIMIT #pagi.getOffset#,#pagi.getPerPage()# </cfquery> <cfoutput> my blog query output here </cfoutput> <cfoutput>#obj.createLinks()#</cfoutput>

About

Pagination Component for Coldfusion

Resources

Stars

Watchers

Forks

Packages

No packages published