Nov 23, 2006

User Defined Functions

Posted by: CFHow.com
Like most programming languages, ColdFusion lets you create your own functions. User defined functions or UDFs for short can be used anywhere on the page where they are located as if they were any other built in ColdFusion function. If you need to use a ColdFusion function on more than one page, consider keeping it in a component or an include file. Technically you could also keep it in the Application File and then you’d be able to access it from any of the applicable pages, but that can turn out really terrible, click here for the why.

In any event, user defined functions add a level of modularity to your programming which really adds to the scalability and manageability of your projects. In this article we’ll go ahead and create a really basic function for formatting a datetime object. Something like this can really come in handy on any sort of big report where might need to format a date time object in the same way in different places. Doing this in a UDF not only makes your code a little easier to read, but also makes modifications a lot simpler.

View the rest of the article on ColdFusion User Defined Functions CFHow.com!
 
Continuing the discussion ...
Comments
THANKS

鲜花's Gravatar Posted by: 鲜花 - Nov 14, 2007 11:32 PM

Post a Comment
Name

Email

Your URL (optional)

Remember my information ?
Yes No
Subscribe to this comment thread ?
Yes No

Input the letter/number code in the image to verify you're a human and not a spammer.

Subscribe to this thread without commenting

Search

About The Author

Recent Comments