- 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.
- Photoshop CC實戰從入門到精通
- AI繪畫教程:Midjourney關鍵詞靈感手冊
- 工業產品設計(Inventor 2010)
- 從零開始:Flash CS6中文版基礎培訓教程
- AutoCAD Civil 3D 2018 場地設計實例教程
- Photoshop CC中文版基礎與實例教程(第7版)
- SPSS進階分析與實務
- 好的PPT會說話:如何打造完美幻燈片
- Getting Started With Oracle SOA Suite 11g R1 – A Hands/On Tutorial
- 從零開始:Photoshop工具詳解與實戰
- 中文版Dreamweaver基礎培訓教程
- Puppet權威指南
- Service Oriented Java Business Integration
- Photoshop+CorelDRAW平面設計案例實戰:從入門到精通(視頻自學全彩版)
- 用Studio One輕松制作你的短視頻音樂