Two things I left out:

   1. The init() function needs to have <cfreturn this> at the end.
   2. When calling functions, you can used named arguments.  The last line
   could be rewritten as: <cfset qGetTopTenTitle =
   reviews.getTopTenTitle(campus=url.Campus)> or <cfset qGetTopTenTitle =
   reviews.getTopTenTitle(campus:url.Campus)>


On Thu, Apr 24, 2008 at 4:36 PM, Sonny Savage <[EMAIL PROTECTED]> wrote:

> Only the functions you explicitly call are executed.  Creating an object is
> copying and instance of that component to memory.  This is useful for
> maintaining the object's state.  When I write CFCs that are actually
> intended for use as objects and aren't simply collections of functions, I
> create an init() function and call that when creating an object.  Using
> CreateObject() instead of <cfobject> makes it easy to call the init in one
> line.  To extend your example, I'd do it this way:
> <cfset reviews = CreateObject("component",
> "#application.cfcpath#reviews").init()>
> <cfset qGetTopTenTitle = reviews.getTopTenTitle(url.Campus)>




-- 
Edward A Savage Jr - "Sonny"
Senior Software Engineer
Creditdiscovery, LLC
"I was gratified to be able to answer promptly. I said I don't know." ~ Mark
Twain


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304209
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to