Coldfusion Hello World
Every language I have ever learned starts with the ubiquitous "Hello World" example program, so here is my version.
You can use just about any text editor – yes even notepad – to build your Coldfusion pages. My favorite editor for developing my applications is Dreamweaver MX, predominately for the tag insight and tag completion that it offers, features that greatly reduce the amount of typing required – always a good thing!
Let me introduce you to your first Coldfusion function and tag:
| Cfoutput | A Coldfusion tag that you use to return data from a database or for general output of function results |
| ucase | The ucase function converts text into upper case. |
So for our Hello World example at its most basic level we will have:
<html>
<head><title>Hello World</title></head>
<body>
<cfoutput>#ucase("hello world")#</cfoutput>
</body>
</html>
(I will assume you have already installed Coldfusion Server on your computer)
Save this page as helloworld.cfm in your <root>:\inetpub\wwwroot\ directory then bring up your favorite browser and go to http://localhost/helloworld.cfm You should see something very similar to: hello world
Congratulations you have just created your first Dynamic we page using coldfusion.
Lets view the source of this page to see what has happened, when I right-click in the browser and choose view source I see the following:
<html>
<head><title>Hello World</title></head>
<body>
HELLO WORLD
</body>
</html>
Notice that the Coldfusion code we had in our source page is gone. The Coldfusion server processed the tag and function and left us with just the results in this case "hello world" in all caps.
This concludes the hello world tutorial.