Thinking About Extending CFML


Throughout this book, you have been learning how to use CFML's built-in tags and functions to produce dynamic Web pages. You have used tags like <cfquery> and <cfoutput> to display information stored in databases, and you have used functions like uCase() and dateFormat() to further tweak your work.

For the next few chapters, you will be exploring how to extend the CFML language by creating your own tags, functions, and components. Once you see how easy it is to do so, you will find that you can make your application code much more elegant and maintainable. It's a very exciting topic. It's even fun.

There are four basic ways in which you can extend ColdFusion:

  • User-Defined Functions. As the name implies, UDFs are functions that you create yourself. If you feel that some function is missing from ColdFusion's list of built-in ones, or that a particular function would be especially handy for an application you're building, you can just make the function yourself. UDFs are what this chapter is all about.

  • Custom Tags. UDFs let you make your own functions, but Custom Tags allow you to create your own CFML tags. Of all the extensibility methods listed here, Custom Tags remain the most flexible and powerful. For more information, see Chapter 23, "Building Reusable Components."

  • ColdFusion Components (CFCs). CFCs are conceptually similar to Custom Tags, but imply a more structured, object-oriented manner of programming. CFCs are also at the heart of ColdFusion MX's Flash and Web Services integration. See Chapter 23 for details.

  • CFX Tags. It is also possible to write your own CFX tags. You can write the code to make the tag do its work in either Java or C++. For more information about writing CFX tags, see the ColdFusion MX documentation or consult our companion book, Advanced Macromedia ColdFusion MX 7 Application Development (Macromedia Press, 0-321-29269-3).

NOTE

If you wish, you can also extend ColdFusion MX by writing JSP tag libraries, COM/ActiveX controls, Java classes or JavaBeans, and more. The list above simply summarizes the extensibility methods specific to ColdFusion.


In this chapter, I will concentrate on the first option, user-defined functions. I recommend that you also read Chapter 23 so you know the extensibility options available to you. In many cases, you can get a particular task done by creating a tag or a function, so it helps to have an understanding of both.



Macromedia Coldfusion MX 7 Web Application Construction Kit
Macromedia Coldfusion MX 7 Web Application Construction Kit
ISBN: 321223675
EAN: N/A
Year: 2006
Pages: 282

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net