In this hands on, we are going to separate out the header and footer and put the code into separate files that will be included.
Tags Used: <cfinclude>, <cfparam>, <cfif>, <cfset>
- Create a folder called includes in the www folder.
In this hands on, we are going to separate out the header and footer and put the code into separate files that will be included.
Tags Used: <cfinclude>, <cfparam>, <cfif>, <cfset>
In this hands on, we will create a custom tag that will handle the display of the header and footer.
Tags Used: <cfif>, <cfelse>, <cfset>, <cfimport>
In this hands on, we will create a custom tag that will handle the display of the header and footer.
Tags Used: <cfif>, <cfelse>, <cfset>, <cfimport>
In this hands on, let's create a component where we will place the convertStringToASCII function inside of a component and instantiate it.
Tags Used: <cfcomponent>, <cffunction>
Functions Used: createObject
By now you've learned the basics of ColdFusion, script vs. tag syntax, scopes, how to deal with data, and even some code-reuse techniques. You're now able to write something useful, so it's time we introduce you to the Request Lifecycle.
You see, when someone requests a ColdFusion page, CF doesn't just start executing your code. There are several events that first take place, which you can be waiting for, and to which you can react. This is not strictly necessary, but you'll find that any complex application will eventually want to make use of some or all of these features, so it's best that you know about them. In order to react to these events, you need to have an Application.cfc file. ColdFusion has designated Application.cfc as a special component that it will automatically look for, and in which we can put our event listeners for request lifecycle events.
A Note on Terminolog
In this hands on we will create an Application.cfc file, create some application wide variables, and implement some of the Application.cfc event handlers.
Functions Used: createTimeSpan, structKeyExists, createObject
One could write a book specifically about Object Oriented Programming (OOP). This chapter is an OOP primer to get you started, but for a more in-depth explanation, check out Matt Gifford's Object Oriented Programming in ColdFusion.
Object Oriented Programming is a set of concepts and techniques that make use of the "object" language construct, to write more reusable, maintainable, and organized code. Objects are implemented differently in every language; in ColdFusion, we have ColdFusion Components (CFCs). Using objects doesn't require OOP, and not every use of objects is OOP. They are simply the building blocks for writing OOP code.
When you write a lot of OOP code, you'll quickly find yourself writing repetitive code to wire together everything necessary to respond to a given request; if you take some time to write a single path through the code that analyzes the request and autom
In this Hands On we are going to create an encapsulated cfc that holds error data.
Functions Used: ArrayAppend, ArrayLen
Object-Relational Mapping (ORM) allows you to work with objects and have them saved to the database automatically. It can greatly simplify create-read-update-delete (CRUD) operations and make your code more object-oriented. Under the hood, ColdFusion uses the industry leading ORM framework called Hibernate.
In this hands on example, you are going to create the ORM entities for the Blog Section.
Functions Used: ormReload