Getting Tag Functionality in Cfscript
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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
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: