For some developers there is an age old argument between the use of ColdFusion tags and <cfscript>, I’m not going to delve too much into this argument as I believe you can use both for different scenarios.
What I will say is that I do like many things about <cfscript>. It is easy to read and arguably more elegant and concise. Of course the annoying thing is that it doesn’t have the full feature set of tags….VERY annoying. So bad in fact that I often ask myself why I bother with it and whether or not Adobe will ever update it?
How many times have you been in the middle of coding something (in <cfscript>) and needed to do cfdump, cflocation, cfabort, cfsavecontent….the list goes on. Because I do like cfscript I did what a lot of other cfscripters do, came up with some methods to add to my Utility.cfc (which I store in application scope) to simulate the functions I cannot natively use when writing cfscript.
Here is an example method for simulating <cfdump>
I set this up as a snippet in eclipse and use a snippet variable to enter the dump value. My trigger text in ud (for Utility Dump) and the snippet is as follows:
I’ve attached my full Utility.cfc which contains the following methods:
- abort
- dump
- location
- param
- sleep
Click here to download Utility.cfc
Thanks for the utility component I found it helpful to use.
Jason
May 15th, 2007
Yeah, very handy. I really hope cfscript is evolved in future releases of ColdFusion. Hmm…going to check what’s new in CF8 now…
Paul Thornton
June 26th, 2007
[...] One thing that does annoy me is that it seems to be an incomplete implementation, e.g. tags aren’t accessible, and I find myself creating utility components replicating cfabort, cfdump, cffile, cflocation, etc… in fact there is a useful Utility component at the following link: Chapter 31 Utility Component [...]
Paul Thornton » Blog Archive » ColdFusion Tags or CFScript
June 26th, 2007