this is great.

Eric Dawson



From: Aidan Whitehall <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
Subject: RE: ### Output all variables?
Date: Thu, 1 Nov 2001 17:49:41 -0000

 > Anyone know of a quick and dirty way to just show all variables that
 > were passed from a previous page?

Save this as OnRequestEnd.cfm.

You'll also need to have CF_SHOW somewhere in your application and alter the
path to it (ie to whereever you end up putting it on your machine).



<!--- OnRequestEnd.cfm v1.1
       [EMAIL PROTECTED]
       28th August 2001 --->

<CFIF CGI.SERVER_NAME IS 127.0.0.1>
    <CFOUTPUT>
    <!--- Application variables. --->
    <H4>Application Variables</H4>

    <CFLOOP COLLECTION="#Application#" ITEM="Key">
       #Variables.Key#: #Evaluate("Application." & Variables.Key)#<BR>
    </CFLOOP>


    <!--- Client variables. --->
    <H4>Client Variables</H4>

    <CFIF NOT ListLen(GetClientVariablesList())>
       <P>There are no client variables</P>
    <CFELSE>
       <CFLOOP LIST="#GetClientVariablesList()#" INDEX="Key">
          #Key#: #Evaluate("Client." & Variables.Key)#<BR>
       </CFLOOP>
    </CFIF>


    <!--- Session variables --->
    <H4>Session Variables</H4>

    <!--- Put the session variables in a list. --->
    <CFSET Variables.SessionList = "">

    <CFLOOP COLLECTION="#session#" ITEM="TheKey">
       <CFSET Variables.SessionList = ListAppend(Variables.SessionList,
TheKey)>
    </CFLOOP>

    <CFIF NOT ListLen(Variables.SessionList)>
       <P>There are no session variables</P>
    <CFELSE>
       <!--- Sort the list --->
       <CFSET Variables.SessionList = ListSort(Variables.SessionList,
"text")>

       <TABLE>
       <CFLOOP LIST="#Variables.SessionList#" INDEX="Key">
          <CFIF IsSimpleValue(Evaluate("Session." & Variables.Key))>
             <TR>
                <TD>#Key#: #session[Key]#</TD>
             </TR>
          <CFELSE>
             <TR>
                <TD>#Key#</TD>
                <TD><CFMODULE
TEMPLATE="#Request.Mappings.ColdFusion#modules/show/show.cfm"
Value="#Evaluate("Session." & Variables.Key)#"></TD>
             </TR>
          </CFIF>
       </CFLOOP>
       </TABLE>
    </CFIF>


    <!--- Cookie variables. --->
    <H4>Cookies</H4>

    <CFIF NOT IsDefined("Cookie")>
       <P>There are no cookies set.</P>
    <CFELSE>
       <CFIF Len(Cookie)>
          <CFLOOP LIST="#Cookie#" INDEX="VariableValue" DELIMITERS=";">
             #Trim(ListFirst(Variables.VariableValue, "="))#:
#Trim(ListLast(Variables.VariableValue, "="))#<BR>
          </CFLOOP>
       </CFIF>
    </CFIF>


    <!--- URL variables (only stored in a structure in 4.5 and above) --->
    <CFSET Variables.Version = ListGetAt(Server.ColdFusion.ProductVersion, 
1)
+ ListGetAt(Server.ColdFusion.ProductVersion, 2) / 10>

    <CFIF Variables.Version GTE 4.5>
       <!--- Put the URL variables in a list. --->
       <CFSET Variables.URLList = "">

       <CFLOOP COLLECTION="#url#" ITEM="Key">
          <CFSET Variables.URLList = ListAppend(Variables.URLList, Key)>
       </CFLOOP>


       <CFSET Variables.URLList = ListSort(Variables.URLList, "text")>

       <H4>URL Variables</H4>

       <CFIF NOT Len(Variables.URLList)>
          <P>There are no URL variables</P>
       <CFELSE>
          <CFLOOP LIST="#Variables.URLList#" INDEX="Key">
             URL.#Key#: #URL[Key]#<BR>
          </CFLOOP>
       </CFIF>
    </CFIF>


    <!--- Form variables --->
    <H4>Form Variables</H4>

    <CFIF NOT IsDefined("Form.FieldNames")>
       <P>There are no form variables</P>
    <CFELSE>
       <CFLOOP LIST="#Form.FieldNames#" INDEX="Key">
          Form.#Key#: #Evaluate("Form." & Key)#<BR>
       </CFLOOP>
    </CFIF>
    </CFOUTPUT>
</CFIF>


--
Aidan Whitehall <[EMAIL PROTECTED]>
Macromedia ColdFusion Developer
Fairbanks Environmental +44 (0)1695 51775



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to