home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / cfexit.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  2.1 KB  |  64 lines

  1. <!--- This example shows the use of CFEXIT, and
  2. is a read-only example --->
  3. <HTML>
  4. <HEAD>
  5. <TITLE>CFEXIT Example</TITLE>
  6. </HEAD>
  7.  
  8. <BODY>
  9. <H3>CFEXIT Example</H3>
  10.  
  11. <P>CFEXIT can be used to abort the processing of the
  12. currently executing CFML custom tag.  Execution will resume
  13. immediately following the invocation of the custom tag in the
  14. page that called the tag.
  15. <H3>Usage of CFEXIT</H3>
  16. <P>CFEXIT is used primarily to perform a conditional stop
  17. of processing inside of a custom tag.  CFEXIT returns control
  18. to the page that called that custom tag, or in the case of
  19. a tag called by another tag, to the calling tag.
  20.  
  21. <!--- CFEXIT can be used inside a CFML custom tag, as
  22. follows: --->
  23. <!--- Place this code (uncomment the appropriate
  24. sections) inside the CFUSION/customtags directory --->
  25.  
  26. <!--- MyCustomTag.cfm --->
  27. <!--- this simple custom tag checks for the existence
  28. of myValue1 and myValue2.  If they are both defined,
  29. the tag adds them and returns the result to the calling
  30. page in the variable "result".  If either or both of the
  31. expected attribute variables is not present, an error message
  32. is generated, and CFEXIT returns control to the
  33. calling page.  --->
  34.  
  35. <!--- <CFIF NOT IsDefined("attributes.myValue2")>
  36.             <CFSET caller.result = "Value2 is not defined">
  37.             <CFEXIT METHOD="ExitTag">
  38.       <CFELSEIF NOT IsDefined("attributes.myValue1")>
  39.             <CFSET caller.result = "Value1 is not defined">
  40.             <CFEXIT METHOD="ExitTag">
  41.       <CFELSE>
  42.               <CFSET value1 = attributes.myValue1>        
  43.               <CFSET value2 = attributes.myValue2>        
  44.             <CFSET caller.result = value1 + value2>
  45.       </CFIF> --->
  46. <!--- End MyCustomTag.cfm --->
  47.  
  48. <!--- And place this code inside your page --->      
  49.  
  50. <!--- <P>The call to the custom tag, and then the result:
  51. <CF_myCustomTag
  52.         myvalue2 = 4>      
  53. <CFOUTPUT>#result#</cFOUTPUT>  --->
  54.  
  55. <P>If CFEXIT is used outside of a custom tag, it functions
  56. like a CFABORT.  For example, the text after this message
  57. will not be processed:
  58. <CFEXIT>
  59. <P>This text will not be executed due to the existence of 
  60. the CFEXIT tag above it.
  61.  
  62. </BODY>
  63. </HTML>       
  64.