CFDump Alternative

ColdFusion , Railo Add comments

CFDUMP is an invaluable tag, it helps immensely with debugging and viewing your objects, but annoyingly it requires CreateObject(java) to work, which is often disabled on shared hosting for security reasons, or even if you run your own server perhaps you need to keep createObject(java) disabled but still use CFDump.

This alternative custom tag gives you the functionality of CFDUMP using JavaScript instead.

I originally created this for use on cflive.net because createObject(java) is disabled and considering what cflive is intended for cfdump is definitely required. A few people have asked how I did it so I thought I would release it for the benefit of anyone else who may want to use it.

Note that because it uses JavaScript this is only good for generating dumps to the browser. If you wanted to create a CFDump on the server and put it into an email, then this will not help you a sthere is of course no JavaScript there to render the code.

You can try it out at www.cflive.net where I have used it to replace the original cfdump tag, so just use <cfdump var="#cgi#"> for example.

This tag was created using the JavaScript dump code from Net Grow, which I have modified slightly to give the following additional functionality.

  • allow multiple dumps on the same page
  • new label attribute to emulate the original cfdump
  • plus of course to generate dumps via CFML pages.

You can download the tag here.

How to use

  • As a custom tag
    simply drop dump.cfm into your global custom Tags folder or into any folder which you have mapped as a customTags folder in your application.cfc
    or just drop into the same folder from which you are calling it, then call it as per any normal custom tag.
    e.g.
    <cf_dump var="#cgi#" label="CGI Scope">
  • via CFIMPORT
    If you do not know how to use cfimport, then go here
    e.g.
    <cfimport prefix="" taglib="/customTags">
    <dump var="#cgi#" label="CGI Scope">
  • Replace the original CFDUMP tag
    If you want all your existing code to work without any changes then you can simply replace the original cfdump tags with mine.
    Here are example locations where you will find the tag, you can just do a search for "dump.cfm" inside your CF or Railo installation
    • ColdFusion 9 location
      C:\ColdFusion9\wwwroot\WEB-INF\cftags\dump.cfm
    • ColdFusion 10 location
      C:\ColdFusion10\cfusion\wwwroot\WEB-INF\cftags\dump.cfm
    • Railo location
      C:\railo4\railo-server\context\library\tag
      Railo uses a dump.cfc by default, but if you copy dump.cfm into this folder it will take precedence over dump.cfc

0 responses to “CFDump Alternative”

Leave a Reply

Leave this field empty

Powered by Mango Blog. Design and Icons by N.Design Studio