In many web development situations, you are often only allowed to use the automatic ColdFusion debugging in the
test and/or QA environments. With a little additional code, you can use the new
<cf_dump> tag in CF5
to display any and all ColdFusion and CGI variables.
This can aid in both new development and problem identification/resolution since the cfdump tag automatically
displays complex variables (i.e. arrays, structures, etc.)
<!--- determine the values you want to display --->
<cfloop list="FORM,URL,APPLICATION,SESSION,REQUEST,COOKIE,CGI"
index="i">
<h5>
<cfoutput>#i#</cfoutput> VARIABLES
</h5>
<cftry>
<cfswitch expression="#i#">
<cfcase value="session"> <!--- lock the session scoped variables --->
<cflock timeout="10"
type="READONLY"
scope="SESSION">
<cfdump var="#evaluate(i)#">
</cflock>
</cfcase>
<cfcase value="application"> <!--- also should lock the application scoped variables --->
<cflock timeout="10"
type="READONLY"
scope="APPLICATION">
<cfdump var="#evaluate(i)#">
</cflock>
</cfcase>
<cfdefaultcase>
<cfdump var="#evaluate(i)#">
</cfdefaultcase>
</cfswitch>
<cfcatch>
<p>An error occurred while trying to display
<strong><cfoutput>#i#</cfoutput></strong> variables.</p>
</cfcatch>
</cftry>
</cfloop>
You can add this code to your OnRequestEnd.cfm page to always show debugging output. You can also easily extend
this idea to only show the output for certain IP addresses or based on other variables that you set to turn the display on and off.
I have created a custom tag using these principles that allows the output variables to be specified and the display
can be controlled based on a user's IP address. This can be downloaded at http://www.nmconsulting.us/tags/
All ColdFusion Tutorials By Author: Nathan Miller
Easy automatic debugging
Extend the use of the new tag in CF5
to display any and all ColdFusion and CGI variables. Author:Nathan Miller Views: 22,405 Posted Date: Saturday, December 21, 2002
Scope your variables
Increase performace and readability by always scoping your variables Author:Nathan Miller Views: 33,140 Posted Date: Monday, May 19, 2003
Add a newsfeed to your site
Use the Moreover news service to add a news
feed to your site using cfhttp and wddx in 5 minutes! Author:Nathan Miller Views: 32,207 Posted Date: Saturday, July 26, 2003
Advanced Server-Side FORM Validation
An advanced set of customizable tags for validating FORM values on the Server-side using User-Defined Functions Author:Nathan Miller Views: 33,009 Posted Date: Monday, December 15, 2003
Dynamically add and remove a 'please wait' message to your complex pages
You can use a combination of and javascript to show a message on the screen
while processing a large data set (or any other long-running task), and then remove the message when the task is complete. Author:Nathan Miller Views: 45,350 Posted Date: Tuesday, January 13, 2004
DHTML Tabs (Part 1 of 2)
Visual tab control generator - Creates an interface that loads all the data in each tab in a single page request. This allows the users to click on each tab in the interface and instantly see the data on that tab without waiting for it to load. Author:Nathan Miller Views: 24,020 Posted Date: Wednesday, October 26, 2005
Coldfusion Master Pages
Use ASP.NET-style master pages to replace your header/footer files for web page layout Author:Nathan Miller Views: 19,478 Posted Date: Wednesday, August 30, 2006
ColdFusion Content Injection
Inject customized content into predefined messages by adding specially formatted placeholders in the message. Author:Nathan Miller Views: 19,308 Posted Date: Wednesday, March 28, 2007