- ColdFusion 9 Developer Tutorial
- John Farrar
- 338字
- 2021-08-05 16:16:36
Our first CFC
We start by creating a file that ends with .cfc
when creating CFCs. Non-CFC files that you have been creating up to this point, and will also continue to create, end with .cfm
.
Each CFC is wrapped by a set of tags and has one or more functions, which are also referred to as methods. We will be creating an object class. There are different types of objects, and a CFC is the type we normally use in ColdFusion. Now, let us look at some empty code, so you can get an idea of what one might look like:
<cfcomponent> <cffunction> </cffunction> </cfcomponent>>
Certainly, we cannot do much with this segment of code. This is just for us to get a first glimpse of CFC code. Here, we get an idea of what it is and start our journey of discovery. You see there is a<cfcomponent>
tag that surrounds the whole CFC. You can add additional attributes, but for now we are going to keep it as simple as possible and try to learn how to write CFCs without getting bogged down with details. You can also see that we have included a function (<cffunction>
) inside the CFC. This is also called a method. You will get used to them being referenced both ways.
Let's start by understanding the personality of our first object. At first, you are likely to wonder why we would call it a personality. This is because most of your objects can be thought of as a computer model of a real-world object. That will also help us with the concept of understanding what objects are and what they do.
Note
The code in this chapter is set up to work on the MySQL database resource. There is a script in the code bundle of Chapter 2 called cfb.sql
that will create the tables needed to make the code work. If this is new to you, you can visit our site at http://books.sosensible.com/. We have tutorials on how to do this for this platform.
- 創意UI:Photoshop玩轉移動UI設計
- 設計模式之禪(第2版)
- 3ds Max/VRay室內設計材質、燈光與建模速查超級手冊
- Flash CC動畫制作案例教程
- SPSS統計分析
- OpenCart 1.4 Template Design Cookbook
- AutoCAD 2020中文版入門、精通與實戰
- Microsoft Azure: Enterprise Application Development
- 詳解AutoCAD 2022室內設計(第6版)
- Photoshop+CorelDRAW 字體設計與創意:草圖/實現/包裝(微課版)
- Photoshop手繪從新手到高手
- SharePoint Designer Tutorial: Working with SharePoint Websites
- Learning Ext JS
- Photoshop CC平面設計實戰從入門到精通
- UG NX 10中文版完全自學手冊