Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / January 2008



Tip: Looking for answers? Try searching our database.

How to do it inside the cfscript?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alecken - 11 Jan 2008 17:39 GMT
I'm trying to do some debugging. But since it is inside the cfscript I can't use cfabort and cfdump. is there similar function for cfcsript debugging?
Ian Skinner - 11 Jan 2008 19:16 GMT
> I'm trying to do some debugging. But since it is inside the cfscript I can't use cfabort and cfdump. is there similar function for cfcsript debugging?

One trick is to put the tag into a function and then call that function
from within <cfscript...>

I.E.

<cffunction name="dumpFunc"...>
  <cfargument name="variable"....

  <cfdump var="#variable#>
</cffunction>

<cfscript>
  //Stuff

  //More Stuff

  //Even More Stuff

  dumpFunc(session)
</cfscript>

Don't know if this would work, but it is how I usually get a
<cfquery...> tag into a <cfscript...> block when that is necessary.
JohnEric - 30 Jan 2008 21:22 GMT
If you do any component development at all, you can add a dump and an abort
function to the base component.

Add the following to the file <cfinstall
dir>\wwwroot\WEB-INF\cftags\component.cfc

<cffunction name="dump" returntype="void" output="true">
    <cfdump var="#arguments#">
</cffunction>

<cffunction name="abort" returntype="void" output="false">
    <cfset dump(argumentCollection=arguments) />
    <cfabort>
</cffunction>

Then you can do something like the following

<cfscript>
    someObj = createObject('component', 'path.to.obj');

    someObj.dump(avar=structNew());

    someObj.abort(var1='abc', var2=arrayNew(1));
</cfscript>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.