While i don't know what the best way might be, this seems to work (when called from a 
custom tag context)


The custom tag, say currentLine.cfm would contain this:

<cfparam name="attributes.r_line" type="variableName">
<cftry>
        <cfoutput>#undef#</cfoutput>
        <cfcatch>
                <cfset currentLine="#cfcatch.tagContext[2].line#">
        </cfcatch>
</cftry>
<cfset "caller.#attributes.r_line#"=currentLine>

It would be called like this:
<cf_currentLine r_line="currentLineNumber">

Where currentLineNumber is the line number where cf_currentLine was called from.

So, you could do:
<cf_currentLine r_line="currentLineNumber"> <cfoutput>Starting Loop at 
#currentLineNumber#<br></cfoutput>
<cfloop..>
...
</cfloop>
<cf_currentLine r_line="currentLineNumber"> <cfoutput>Ending Loop at 
#currentLineNumber#<br></cfoutput>

HTH
-Ryan

-----Original Message-----
From: Hagan, Ryan Mr (Contractor ACI) [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2003 12:55 PM
To: CF-Talk
Subject: get the current line number?


Hello,

Is there a way to get the current line number in Cold Fusion?  Basically,
I'm writing a small tag in CF to log certain events, and I'd like to be able
to tell what line number (from the original cfm file) certain pieces of code
were executed on.  Thanks!

Ryan Hagan
ph: 540-731-3588


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to