Search code examples
coldfusioncoldfusion-9

How to get the information about the page that call .cfc page and function? ColdFusion9


I have global function in my system that was implemented while ago before I even started maintaining the system. One of the recent projects involved some major updates in that function. I have set the cfmail with some information inside in hope that I will get the .cfm page that call that function. So far only that I got is the page where the function is located but I already knew that. I got this information with this function:

GetDirectoryFromPath(path)

I was wondering if there is any other function that can give me the name of the page that called the function? If anyone can help me solve this problem please let me know. I'm still doing research but there is nothing that I came accross that would be helpful in my case.


Solution

  • I use CF9 and did this:

    In a CFC

    <cffunction name="dumpCGI" returntype="void" output="yes">
    <cfdump var="#cgi#">
    </cffunction>
    

    In the calling template:

    obj = createObject("component", "Something");
    obj.dumpCGI();
    

    I saw 3 variables that correctly identified the calling template. Once you pick the one you want to use, you can decide how to process it.