<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Object Oriented Pagination in ColdFusion</title>
	<atom:link href="http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/</link>
	<description></description>
	<lastBuildDate>Sun, 08 Jan 2012 15:53:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-1613</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Tue, 13 Sep 2011 10:10:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-1613</guid>
		<description>Hi Thangapandyan

It looks like there is a typo in the getPage function. I&#039;ve fixed it in the post. Rather than this:

&lt;code&gt;
&lt;cfset variables.page = arguments.page&gt;
&lt;cfset var personData = ...&gt;
&lt;/code&gt;

it should have read:

&lt;code&gt;
&lt;cfset var personData = 0&gt;
&lt;cfset variables.page = arguments.page&gt;
&lt;cfset personData = ...&gt;
&lt;/code&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Thangapandyan</p>
<p>It looks like there is a typo in the getPage function. I&#8217;ve fixed it in the post. Rather than this:</p>
<p><code><br />
&lt;cfset variables.page = arguments.page&gt;<br />
&lt;cfset var personData = ...&gt;<br />
</code></p>
<p>it should have read:</p>
<p><code><br />
&lt;cfset var personData = 0&gt;<br />
&lt;cfset variables.page = arguments.page&gt;<br />
&lt;cfset personData = ...&gt;<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ThangapandyanV</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-1611</link>
		<dc:creator>ThangapandyanV</dc:creator>
		<pubDate>Mon, 12 Sep 2011 11:36:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-1611</guid>
		<description>Hi,
i have two coldfusion component files using  for to arrive pagination in my application,file name  called personGateway.cfc and personpaginator.cfc,
first file name contains below details,

 
	
 
	
		
		
	
 
	
		
		
		
		
		
		
			select top #pageSize# *
	from mstproperty
	where
		1=1
		#where#
		and pid not in (
			select top #recordsToSkip# pid
			from mstproperty
			where
				1=1
				#where#
			#orderBy#
		)
	#orderBy#
		
		
	
 
	
		
		
		
			select count(*) as num
	from mstproperty
	where
		1=1
		#where#
		
		
	
 


and second file contains below details,



	
	
	
	
 
	
	
 
	
		
		
		
		
		
		
		
		
	
 
	
		
		
		
		
	
 
	
		
			
		
		
	
 
	
		
		
		
			
		
		
	
 
	
		
		
		
	
 
	
		
		
		
	
 


and i a  am using the below file for calling the coldfusion component file to my application for arrive the pagination in my application,file name called pagination1.cfm



 

	and marketid = 3  and propertytypeid = 2 and statusid not in (1,7)

 

	order by propertyname

 


&lt;!--- Create our paginator component. --&gt;




		
&lt;!--- Let&#039;s assume the page is pased in via the URL. --&gt;

 
&lt;!--- Calculate our page variables. --&gt;






&lt;!--- Display the data --&gt;

	#lastName#, #firstName#



&lt;!--- Display the page navigator --&gt;
&lt;a href=&quot;page.cfm?page=#prevPage#&quot; rel=&quot;nofollow&quot;&gt;Previous&lt;/a&gt;
Page #page# of #totalPages#
&lt;a href=&quot;page.cfm?page=#nextPage#&quot; rel=&quot;nofollow&quot;&gt;Next&lt;/a&gt;
		
but when i ran the above code i got the below error 

The web site you are accessing has experienced an unexpected error.
Please contact the website administrator. 

The following information is meant for the website developer for debugging purposes.  

Error Occurred While Processing Request  
Local variable personData on line 25 must be grouped at the top of the function body.  
 
  
The error occurred in D:\web\Oconnordata\Pagination1.cfm: line 16
 
14 : 
15 : &lt;!--- Create our paginator component. --&gt;
16 : 
17 : 
18 : 

 

--------------------------------------------------------------------------------
 
Resources: 
Check the ColdFusion documentation to verify that you are using the correct syntax. 
Search the Knowledge Base to find a solution to your problem. 

 
Browser   Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; InfoPath.2; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; MSN OptimizedIE8;ENIN) 
Remote Address   127.0.0.1 
Referrer    
Date/Time   12-Sep-11 05:00 PM 
 
Stack Trace (click to expand)  
at cfPagination12ecfm889454527.runPage(D:\web\Oconnordata\Pagination1.cfm:16) 


coldfusion.compiler.ASTvariableDefinition$VarPositionException: Local variable personData on line 25 must be grouped at the top of the function body.
	at coldfusion.compiler.ASTvariableDefinition.checkCfscript(ASTvariableDefinition.java:158)
	at coldfusion.compiler.ASTvariableDefinition.checkPosition(ASTvariableDefinition.java:116)
	at coldfusion.compiler.ASTvariableDefinition.register(ASTvariableDefinition.java:87)
	at coldfusion.compiler.SemanticAnalyzer.transform(SemanticAnalyzer.java:196)
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:86)
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)
	at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:307)
	at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:119)
	at coldfusion.runtime.TemplateClassLoader$1.fetch(TemplateClassLoader.java:310)
	at coldfusion.util.LruCache.get(LruCache.java:180)
	at coldfusion.runtime.TemplateClassLoader$TemplateCache.fetchSerial(TemplateClassLoader.java:254)
	at coldfusion.util.AbstractCache.fetch(AbstractCache.java:58)
	at coldfusion.util.SoftCache.get(SoftCache.java:81)
	at coldfusion.runtime.TemplateClassLoader.findClass(TemplateClassLoader.java:476)
	at coldfusion.runtime.RuntimeServiceImpl.getFile(RuntimeServiceImpl.java:752)
	at coldfusion.runtime.RuntimeServiceImpl.resolveTemplatePath(RuntimeServiceImpl.java:733)
	at coldfusion.runtime.TemplateProxyFactory.getTemplateFileHelper(TemplateProxyFactory.java:1377)
	at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:1330)
	at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:38)
	at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:65)
	at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:4638)
	at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4483)
	at cfPagination12ecfm889454527.runPage(D:\web\Oconnordata\Pagination1.cfm:16)
	at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
	at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:483)
	at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
	at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:288)
	at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
	at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
	at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
	at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
	at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
	at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
	at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
	at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
	at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
	at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
	at coldfusion.CfmServlet.service(CfmServlet.java:198)
	at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
	at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
	at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
	at jrun.servlet.FilterChain.service(FilterChain.java:101)
	at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
	at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
	at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
	at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
	at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
	at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
	at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
	at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
	at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

 
 
kindly help us to resolve this.

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
i have two coldfusion component files using  for to arrive pagination in my application,file name  called personGateway.cfc and personpaginator.cfc,<br />
first file name contains below details,</p>
<p>			select top #pageSize# *<br />
	from mstproperty<br />
	where<br />
		1=1<br />
		#where#<br />
		and pid not in (<br />
			select top #recordsToSkip# pid<br />
			from mstproperty<br />
			where<br />
				1=1<br />
				#where#<br />
			#orderBy#<br />
		)<br />
	#orderBy#</p>
<p>			select count(*) as num<br />
	from mstproperty<br />
	where<br />
		1=1<br />
		#where#</p>
<p>and second file contains below details,</p>
<p>and i a  am using the below file for calling the coldfusion component file to my application for arrive the pagination in my application,file name called pagination1.cfm</p>
<p>	and marketid = 3  and propertytypeid = 2 and statusid not in (1,7)</p>
<p>	order by propertyname</p>
<p><!--- Create our paginator component. --></p>
<p><!--- Let's assume the page is pased in via the URL. --></p>
<p><!--- Calculate our page variables. --></p>
<p><!--- Display the data --></p>
<p>	#lastName#, #firstName#</p>
<p><!--- Display the page navigator --><br />
<a href="page.cfm?page=#prevPage#" rel="nofollow">Previous</a><br />
Page #page# of #totalPages#<br />
<a href="page.cfm?page=#nextPage#" rel="nofollow">Next</a></p>
<p>but when i ran the above code i got the below error </p>
<p>The web site you are accessing has experienced an unexpected error.<br />
Please contact the website administrator. </p>
<p>The following information is meant for the website developer for debugging purposes.  </p>
<p>Error Occurred While Processing Request<br />
Local variable personData on line 25 must be grouped at the top of the function body.  </p>
<p>The error occurred in D:\web\Oconnordata\Pagination1.cfm: line 16</p>
<p>14 :<br />
15 : <!--- Create our paginator component. --><br />
16 :<br />
17 :<br />
18 : </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Resources:<br />
Check the ColdFusion documentation to verify that you are using the correct syntax.<br />
Search the Knowledge Base to find a solution to your problem. </p>
<p>Browser   Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; InfoPath.2; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E; MSN OptimizedIE8;ENIN)<br />
Remote Address   127.0.0.1<br />
Referrer<br />
Date/Time   12-Sep-11 05:00 PM </p>
<p>Stack Trace (click to expand)<br />
at cfPagination12ecfm889454527.runPage(D:\web\Oconnordata\Pagination1.cfm:16) </p>
<p>coldfusion.compiler.ASTvariableDefinition$VarPositionException: Local variable personData on line 25 must be grouped at the top of the function body.<br />
	at coldfusion.compiler.ASTvariableDefinition.checkCfscript(ASTvariableDefinition.java:158)<br />
	at coldfusion.compiler.ASTvariableDefinition.checkPosition(ASTvariableDefinition.java:116)<br />
	at coldfusion.compiler.ASTvariableDefinition.register(ASTvariableDefinition.java:87)<br />
	at coldfusion.compiler.SemanticAnalyzer.transform(SemanticAnalyzer.java:196)<br />
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:86)<br />
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)<br />
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)<br />
	at coldfusion.compiler.Treewalker.postorder(Treewalker.java:27)<br />
	at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:307)<br />
	at coldfusion.compiler.NeoTranslator.translateJava(NeoTranslator.java:119)<br />
	at coldfusion.runtime.TemplateClassLoader$1.fetch(TemplateClassLoader.java:310)<br />
	at coldfusion.util.LruCache.get(LruCache.java:180)<br />
	at coldfusion.runtime.TemplateClassLoader$TemplateCache.fetchSerial(TemplateClassLoader.java:254)<br />
	at coldfusion.util.AbstractCache.fetch(AbstractCache.java:58)<br />
	at coldfusion.util.SoftCache.get(SoftCache.java:81)<br />
	at coldfusion.runtime.TemplateClassLoader.findClass(TemplateClassLoader.java:476)<br />
	at coldfusion.runtime.RuntimeServiceImpl.getFile(RuntimeServiceImpl.java:752)<br />
	at coldfusion.runtime.RuntimeServiceImpl.resolveTemplatePath(RuntimeServiceImpl.java:733)<br />
	at coldfusion.runtime.TemplateProxyFactory.getTemplateFileHelper(TemplateProxyFactory.java:1377)<br />
	at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:1330)<br />
	at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:38)<br />
	at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:65)<br />
	at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:4638)<br />
	at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4483)<br />
	at cfPagination12ecfm889454527.runPage(D:\web\Oconnordata\Pagination1.cfm:16)<br />
	at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)<br />
	at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:483)<br />
	at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)<br />
	at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:288)<br />
	at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)<br />
	at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)<br />
	at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)<br />
	at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)<br />
	at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)<br />
	at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)<br />
	at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)<br />
	at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)<br />
	at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)<br />
	at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)<br />
	at coldfusion.CfmServlet.service(CfmServlet.java:198)<br />
	at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)<br />
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)<br />
	at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)<br />
	at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)<br />
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)<br />
	at jrun.servlet.FilterChain.service(FilterChain.java:101)<br />
	at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)<br />
	at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)<br />
	at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)<br />
	at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)<br />
	at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)<br />
	at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)<br />
	at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)<br />
	at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)<br />
	at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)</p>
<p>kindly help us to resolve this.</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-1610</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Mon, 12 Sep 2011 11:26:43 +0000</pubDate>
		<guid isPermaLink="false">#comment-1610</guid>
		<description>Hi Thangapandyan, this is not an event gateway that you configure in coldfusion administrator. This cfc is named a gateway keeping in line with the gateway design pattern (http://martinfowler.com/eaaCatalog/gateway.html). It&#039;s just a regular cfc.</description>
		<content:encoded><![CDATA[<p>Hi Thangapandyan, this is not an event gateway that you configure in coldfusion administrator. This cfc is named a gateway keeping in line with the gateway design pattern (<a href="http://martinfowler.com/eaaCatalog/gateway.html" rel="nofollow">http://martinfowler.com/eaaCatalog/gateway.html</a>). It&#8217;s just a regular cfc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ThangapandyanV</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-1609</link>
		<dc:creator>ThangapandyanV</dc:creator>
		<pubDate>Mon, 12 Sep 2011 11:20:42 +0000</pubDate>
		<guid isPermaLink="false">#comment-1609</guid>
		<description>Hi,
   How can i configure the gateway in coldfusion administrator.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
   How can i configure the gateway in coldfusion administrator.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-1608</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Mon, 12 Sep 2011 10:58:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-1608</guid>
		<description>Hi Thangapandyan, sorry not sure what you are asking. All of the cfc and cfm code is in the article.</description>
		<content:encoded><![CDATA[<p>Hi Thangapandyan, sorry not sure what you are asking. All of the cfc and cfm code is in the article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thangapandyan</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-1606</link>
		<dc:creator>Thangapandyan</dc:creator>
		<pubDate>Mon, 12 Sep 2011 04:26:56 +0000</pubDate>
		<guid isPermaLink="false">#comment-1606</guid>
		<description>hi,
   really i don&#039;t know how to use the paginator example ,can you explain what are content come under .cfc pages and .cfm pages</description>
		<content:encoded><![CDATA[<p>hi,<br />
   really i don&#8217;t know how to use the paginator example ,can you explain what are content come under .cfc pages and .cfm pages</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-91</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Wed, 15 Jul 2009 04:29:56 +0000</pubDate>
		<guid isPermaLink="false">#comment-91</guid>
		<description>Mescalito2, thanks for such a thorough review and corrections. Regarding your points:

1. The gateway would be used something like this:

&lt;!--- First create the gateway object separately ---&gt;
&lt;cfset personGateway = createObject(&quot;component&quot;,&quot;PersonGateway&quot;).init(dsn)&gt;

&lt;!--- Then create the pagination and provide the gateway as a parameter ---&gt;
&lt;cfset paginator = createObject(&quot;component&quot;,&quot;PersonPaginator&quot;).init(
         personGateway,
         30,
         &quot;and isActive=1&quot;,
         &quot;order by lastName asc, firstName asc&quot;
      )&gt;

This type of relationship is called composition (the gateway is &quot;composed&quot; inside the paginator). Composition is a generally preferred relationship over inheritance (where the paginator extends the gateway).

Inside the paginator, whenever you need to use the gateway you would refer to variables.personGateway

2. It should be named PersonPaginator. Thanks, I have fixed this.

3. Thanks, fixed. 

4. I can see what you are getting at. What was missing was the page should have been set inside the getPage() function and the page should have been initialised to zero. Not sure about setting the current page on init() and then /also/ passing it in to the getPage() function. I think I will leave it out of the init() for now.

5. Thanks, fixed.

6. Yes, would be nicer to include the cfoutput&#039;s

Thanks for letting me know about this swarm of typos!</description>
		<content:encoded><![CDATA[<p>Mescalito2, thanks for such a thorough review and corrections. Regarding your points:</p>
<p>1. The gateway would be used something like this:</p>
<p>&lt;!&#8212; First create the gateway object separately &#8212;&gt;<br />
&lt;cfset personGateway = createObject(&quot;component&quot;,&quot;PersonGateway&quot;).init(dsn)&gt;</p>
<p>&lt;!&#8212; Then create the pagination and provide the gateway as a parameter &#8212;&gt;<br />
&lt;cfset paginator = createObject(&quot;component&quot;,&quot;PersonPaginator&quot;).init(<br />
         personGateway,<br />
         30,<br />
         &quot;and isActive=1&quot;,<br />
         &quot;order by lastName asc, firstName asc&quot;<br />
      )&gt;</p>
<p>This type of relationship is called composition (the gateway is &quot;composed&quot; inside the paginator). Composition is a generally preferred relationship over inheritance (where the paginator extends the gateway).</p>
<p>Inside the paginator, whenever you need to use the gateway you would refer to variables.personGateway</p>
<p>2. It should be named PersonPaginator. Thanks, I have fixed this.</p>
<p>3. Thanks, fixed. </p>
<p>4. I can see what you are getting at. What was missing was the page should have been set inside the getPage() function and the page should have been initialised to zero. Not sure about setting the current page on init() and then /also/ passing it in to the getPage() function. I think I will leave it out of the init() for now.</p>
<p>5. Thanks, fixed.</p>
<p>6. Yes, would be nicer to include the cfoutput&#8217;s</p>
<p>Thanks for letting me know about this swarm of typos!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mescalito2</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-90</link>
		<dc:creator>Mescalito2</dc:creator>
		<pubDate>Tue, 14 Jul 2009 11:22:50 +0000</pubDate>
		<guid isPermaLink="false">#comment-90</guid>
		<description>Thanks!</description>
		<content:encoded><![CDATA[<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mescalito2</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-89</link>
		<dc:creator>Mescalito2</dc:creator>
		<pubDate>Tue, 14 Jul 2009 07:59:36 +0000</pubDate>
		<guid isPermaLink="false">#comment-89</guid>
		<description>Hi! Thanks for your post, it has been very useful. I want to share some bugs that I have found:

1. I really don&#039;t understand how do you use/call the &quot;gateway&quot;, what I did is to extend from the &quot;gateway&quot; in the peoplePaginator component

?????? no idea how to use this: &lt;cfset variables.peopleGateway = arguments.peopleGateway&gt; 

My solution: &lt;cfcomponent extends=&quot;peoplegateway&quot; output=&quot;false&quot;&gt;

2. You named the component &quot;PeoplePaginator&quot; but you are calling it as a &quot;PersonPaginator&quot;. That is ambigous and it doesn&#039;t work (at least for me)

3. In getNumberOfPages function, when you are doing the &quot;mod&quot; calc, you are using the wrong var 

WRONG: &lt;cfif totalPages mod variables.pageSize gt 0&gt;
GOOD: &lt;cfif totalRecords mod variables.pageSize gt 0&gt;

4. On PeoplePaginator init, I think you need to pass the current page number as an argument

+++ when using the object +++
&lt;cfparam name=&quot;url.page&quot; default=&quot;1&quot;&gt;
&lt;cfset page = url.page&gt;

&lt;cfset paginator.init(
         10,
         &quot;and isActive=1&quot;,
         &quot;order by lastName asc, firstName asc&quot;,
	 page  &lt;&lt;&lt;---- This is the new parameter
      )&gt;
+++++

=== init function within the component ===
&lt;cffunction name=&quot;init&quot; output=&quot;false&quot;&gt;
      &lt;cfargument name=&quot;pageSize&quot;&gt;
      &lt;cfargument name=&quot;where&quot;&gt;
      &lt;cfargument name=&quot;orderBy&quot;&gt;
      &lt;cfargument name=&quot;currentPageNumber&quot;&gt; &lt;&lt;&lt;---- This is the new argument
      &lt;cfset variables.pageSize = arguments.pageSize&gt;
      &lt;cfset variables.where = arguments.where&gt;
      &lt;cfset variables.orderBy = arguments.orderBy&gt;
      &lt;cfset variables.page = arguments.currentPageNumber&gt; &lt;&lt;&lt;---- This is the new argument
   &lt;/cffunction&gt;
======

5. This function is not returning a value getNextPageNumber

6. Here you have to put the output coldfusion tags:
&lt;cfoutput&gt;&lt;a href=&quot;test.cfm?page=#prevPage#&quot;&gt;Previous&lt;/a&gt;
Page #page# of #totalPages#
&lt;a href=&quot;test.cfm?page=#nextPage#&quot;&gt;Next&lt;/a&gt;&lt;/cfoutput&gt; 

I think there are others errors but I dind&#039;t track them. If you want to download the code (working) you can do it from: http://dev.dualcredit.itap.purdue.edu/mescalito2-paginator.rar
and by the way, remember to change the datasources</description>
		<content:encoded><![CDATA[<p>Hi! Thanks for your post, it has been very useful. I want to share some bugs that I have found:</p>
<p>1. I really don&#8217;t understand how do you use/call the &quot;gateway&quot;, what I did is to extend from the &quot;gateway&quot; in the peoplePaginator component</p>
<p>?????? no idea how to use this: &lt;cfset variables.peopleGateway = arguments.peopleGateway&gt; </p>
<p>My solution: &lt;cfcomponent extends=&quot;peoplegateway&quot; output=&quot;false&quot;&gt;</p>
<p>2. You named the component &quot;PeoplePaginator&quot; but you are calling it as a &quot;PersonPaginator&quot;. That is ambigous and it doesn&#8217;t work (at least for me)</p>
<p>3. In getNumberOfPages function, when you are doing the &quot;mod&quot; calc, you are using the wrong var </p>
<p>WRONG: &lt;cfif totalPages mod variables.pageSize gt 0&gt;<br />
GOOD: &lt;cfif totalRecords mod variables.pageSize gt 0&gt;</p>
<p>4. On PeoplePaginator init, I think you need to pass the current page number as an argument</p>
<p>+++ when using the object +++<br />
&lt;cfparam name=&quot;url.page&quot; default=&quot;1&quot;&gt;<br />
&lt;cfset page = url.page&gt;</p>
<p>&lt;cfset paginator.init(<br />
         10,<br />
         &quot;and isActive=1&quot;,<br />
         &quot;order by lastName asc, firstName asc&quot;,<br />
	 page  &lt;&lt;&lt;&#8212;- This is the new parameter<br />
      )&gt;<br />
+++++</p>
<p>=== init function within the component ===<br />
&lt;cffunction name=&quot;init&quot; output=&quot;false&quot;&gt;<br />
      &lt;cfargument name=&quot;pageSize&quot;&gt;<br />
      &lt;cfargument name=&quot;where&quot;&gt;<br />
      &lt;cfargument name=&quot;orderBy&quot;&gt;<br />
      &lt;cfargument name=&quot;currentPageNumber&quot;&gt; &lt;&lt;&lt;&#8212;- This is the new argument<br />
      &lt;cfset variables.pageSize = arguments.pageSize&gt;<br />
      &lt;cfset variables.where = arguments.where&gt;<br />
      &lt;cfset variables.orderBy = arguments.orderBy&gt;<br />
      &lt;cfset variables.page = arguments.currentPageNumber&gt; &lt;&lt;&lt;&#8212;- This is the new argument<br />
   &lt;/cffunction&gt;<br />
======</p>
<p>5. This function is not returning a value getNextPageNumber</p>
<p>6. Here you have to put the output coldfusion tags:<br />
&lt;cfoutput&gt;&lt;a href=&quot;test.cfm?page=#prevPage#&quot;&gt;Previous&lt;/a&gt;<br />
Page #page# of #totalPages#<br />
&lt;a href=&quot;test.cfm?page=#nextPage#&quot;&gt;Next&lt;/a&gt;&lt;/cfoutput&gt; </p>
<p>I think there are others errors but I dind&#8217;t track them. If you want to download the code (working) you can do it from: <a href="http://dev.dualcredit.itap.purdue.edu/mescalito2-paginator.rar" rel="nofollow">http://dev.dualcredit.itap.purdue.edu/mescalito2-paginator.rar</a><br />
and by the way, remember to change the datasources</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevan Stannard</title>
		<link>http://blog.stannard.net.au/2007/11/02/object-oriented-pagination-in-coldfusion/comment-page-1/#comment-97</link>
		<dc:creator>Kevan Stannard</dc:creator>
		<pubDate>Mon, 16 Jun 2008 04:00:14 +0000</pubDate>
		<guid isPermaLink="false">#comment-97</guid>
		<description>Hi Dani

Looks like this may be simpler in MySQL than in MSSQL2000; we don&#039;t need the subquery. Looking up the LIMIT syntax - http://dev.mysql.com/doc/refman/5.0/en/select.html - looks like we get something like:

&lt;cfset pageSize = 30&gt;
&lt;cfset page = page + 1&gt;
&lt;cfset recordsToSkip = (page - 1) * pageSize&gt;

&lt;cfquery name=&quot;getLabour&quot; datasource=&quot;andes&quot;&gt;
select *
from control_lab
where proID = &#039;#URL.proID#&#039;
and empID = &#039;#getNames.empID#&#039;
order by proDate desc
limit #recordsToSkip#, #pageSize#
&lt;/cfquery&gt;

I haven&#039;t tested this but, who knows, it might just work.</description>
		<content:encoded><![CDATA[<p>Hi Dani</p>
<p>Looks like this may be simpler in MySQL than in MSSQL2000; we don&#8217;t need the subquery. Looking up the LIMIT syntax &#8211; <a href="http://dev.mysql.com/doc/refman/5.0/en/select.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.0/en/select.html</a> &#8211; looks like we get something like:</p>
<p>&lt;cfset pageSize = 30&gt;<br />
&lt;cfset page = page + 1&gt;<br />
&lt;cfset recordsToSkip = (page &#8211; 1) * pageSize&gt;</p>
<p>&lt;cfquery name=&quot;getLabour&quot; datasource=&quot;andes&quot;&gt;<br />
select *<br />
from control_lab<br />
where proID = &#8216;#URL.proID#&#8217;<br />
and empID = &#8216;#getNames.empID#&#8217;<br />
order by proDate desc<br />
limit #recordsToSkip#, #pageSize#<br />
&lt;/cfquery&gt;</p>
<p>I haven&#8217;t tested this but, who knows, it might just work.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

