Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

ColdFusion Tutorial – Testing and Troubleshooting Your Templates

Page 3 — Testing and Troubleshooting Your Templates

First, make sure that you’re testing your templates through your Web server rather than as a file. The URL in your browser should read rather than file://C:web_sitesome_template.cfm. ColdFusion only works in conjunction with Web server software. This may seem obvious, but when you’re coding like the wind and Alt+Tabbing between a text editor and your browser, it’s easy to forget. If you’re using an outside Web provider, this means that you’ll have to upload your templates before you can test them, unless you’re lucky enough to afford a copy of CF on your own machine.

If you’ve botched up your code somehow, ColdFusion will return an error message rather than the expertly formatted HTML you hoped to see. Some of the most common errors come from bad SQL statements in your queries. If you get one of these, check your query statement to make sure you’re using text operators for text fields and numeric operators for numbers. Also be sure that every field name you mention in your CFQUERY and CFOUTPUT sections actually appears in your table. Just one stray character will screw things up.

You might also encounter a situation in which you see the top part of your page (headers, etc.) but nothing below. This occurs when ColdFusion processes your CFQUERY successfully but then gets hung up on something in your CFOUTPUT section. 

By and large, ColdFusion’s error messages are pretty cryptic, but, once you develop a few templates, you’ll get a feel for where to look for problems.

As mentioned before, we’re really only fiddling with the tip of the iceberg here. Once you start using the program, your idea bulb will light at odd moments as you envision more time-saving devices, and you’ll want to delve deeper into CF’s docs. Most of these ideas come in the middle of the night, and by the time you wake up and get some coffee, you’ve forgotten them.

That’s why I’ll cover some great resources in the next section.