Um.  I think that you have pretty much hit on the definition of a UDF --
it's a user defined function.  Functions are called with parameters and
return a result (unless you write them wrong, in which case they hang :-).

And yes, you could use an include file repeatedly for this.  However, I
prefer syntax like:

#TrimToWord(query.textfield, 500)#

to:

<cfset string = query.textfield>
<cfset length = 500>
<cfinclude template="includes/TrimToWord.cfm">

Of course, you could also write this as a custom tag.  You could put a
snippet in your library and just edit what variables it works on.  There are
a half-dozen ways to do similar things, I'm sure.  I guess it's all in the
way you think and what makes the most sense to you.


  --Ben Doom
    Programmer & General Lackey
    Moonbow Software

: -----Original Message-----
: From: Tony Weeg [mailto:tony@;navtrak.net]
: Sent: Tuesday, November 12, 2002 4:53 PM
: To: CF-Talk
: Subject: RE: cfscript performance (was cfscript book)
:
:
: but isnt an included file,
: with some reusable code in it
: just as fast as a UDF? I guess maybe the only
: reason not would be the time to access the file
: referenced in the cfinclude tag....right?
:
: and really, couldn't it be said that a UDF is some bit
: of code, waiting for some inputted data to act upon, that then
: returns a desired result (or non-desired sometimes!!!)
:
: just wondering....
:
: ..tony
:
: Tony Weeg
: Senior Web Developer
: Information System Design
: Navtrak, Inc.
: Fleet Management Solutions
: www.navtrak.net
: 410.548.2337
:
:
: -----Original Message-----
: From: Ben Doom [mailto:bdoom@;moonbow.com]
: Sent: Tuesday, November 12, 2002 4:39 PM
: To: CF-Talk
: Subject: RE: cfscript performance (was cfscript book)
:
:
: I would tend to argue that you should at least know the basics so that
: you
: can create quick UDFs for things you do often -- that's saved me hours
: and
: hours of coding time.
:
: They are easy to write, use, and (often important around here) I can
: write
: one and give it to my boss for him to use.  :-)
:
:   --Ben Doom
:     Programmer & General Lackey
:     Moonbow Software
:
: : -----Original Message-----
: : From: Tony Weeg [mailto:tony@;navtrak.net]
: : Sent: Tuesday, November 12, 2002 4:29 PM
: : To: CF-Talk
: : Subject: RE: cfscript performance (was cfscript book)
: :
: :
: : it certainly helps....thanks for the info....although
: : I am sure there will be a flood of opinions on this, so that's
: : really why I started the thread....
: :
: : should any of us who don't already know, bother learning that way of
: : coding for cf?
: :
: : ..tony
: :
: : Tony Weeg
: : Senior Web Developer
: : Information System Design
: : Navtrak, Inc.
: : Fleet Management Solutions
: : www.navtrak.net
: : 410.548.2337
: :
: :
: : -----Original Message-----
: : From: Fitch, Tyler [mailto:tfitch@;isitedesign.com]
: : Sent: Tuesday, November 12, 2002 4:21 PM
: : To: CF-Talk
: : Subject: cfscript performance (was cfscript book)
: :
: :
: : Tony,
: :
: : Pre CFMX using a block of cfscript to set some variables or perform
: most
: : tasks would give you an increase in performance.  Now with MX if you
: : have a block of cfscript and set 10 variables compared to 10 <cfset>
: : tags the only difference would be the white space between the <cfset>
: : tags.
: :
: : HTH,
: :
: : t
: :
: : **********************************************************************
: : Tyler M. Fitch
: : Certified Advanced ColdFusion 5 Developer
: : http://isitedesign.com
: : **********************************************************************
: :
: : -----Original Message-----
: : From: Tony Weeg [mailto:tony@;navtrak.net]
: : Sent: Tuesday, November 12, 2002 12:57 PM
: : To: CF-Talk
: : Subject: RE: cfscript book
: :
: :
: : now I am asking all of these questions, is cfscript really that good
: to
: : use? or could I go all day long using cftags and never see much
: : performance difference....
: :
: : tony
: :
: : Tony Weeg
: : Senior Web Developer
: : Information System Design
: : Navtrak, Inc.
: : Fleet Management Solutions
: : www.navtrak.net
: : 410.548.2337
: :
: :
: :
: :
:
: 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to