OpenBD Wiki

From OpenBD
Jump to: navigation, search

CFDUMP

Contents

Description

The CFDUMP tag is used to quickly and easily output variable contents to a CFML page. The contents of both simple and complex variables can be dumped.

Syntax

<cfdump var="#variableToDump#" version="long | short">

Attributes

AttributeReq/OptDefaultDescription
varoptionalN/AThe variable to dump. Note that the variable name must be wrapped in pound signs (#). If the var attribute is not used, CFDUMP dumps variables in all scopes except CGI and SERVER. CGI and SERVER can be dumped explicitly but they are not included when CFDUMP is used without the var attribute.
versionoptionaldepends on variable typeThe type of dump to perform. Valid values for the version attribute are LONG and SHORT. The defaults for specific variable types are as follows:
  • query: LONG
  • xml: SHORT
  • CFCs: LONG
  • complex variables nested in other variables: SHORT
  • all other variable types: LONG


Notes

CFDUMP provides a quick and easy way to dump the contents of both simple and complex variables, which is very handy for debugging and allows developers to see the contents of variables without having to write loop/output routines themselves.

CFDUMP works with all variable types, but note that when dumping a CFC, the contents of the variables scope is not dumped. Also note that when complex variables are nested inside other variables, for example if a query is a struct member, the version of the dump for the query will be short.

cfdump official docs

Usage

Dump all variables in all scopes other than CGI and SERVER:

<cfdump>

Dump a query object including all records returned:

<cfdump var="#myQuery#" />

Dump high-level information about a query object but do not display all the records returned by the query:

<cfdump var="#myQuery#" version="short" />

Personal tools