home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Documentation / snippets / cfmodule.cfm < prev    next >
Encoding:
Text File  |  1999-04-12  |  2.5 KB  |  101 lines

  1. <!--- This view-only example shows the use of CFMODULE --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>CFMODULE Example</TITLE>
  5. </HEAD>
  6.  
  7. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  8.  
  9. <BODY  bgcolor="#FFFFD5">
  10.  
  11. <BODY>
  12. <H3>CFMODULE Example</H3>
  13.  
  14. <P>
  15. This example shows the use of CFMODULE to call a sample custom 
  16. tag inline.
  17. </P>
  18. <P>
  19. This example makes use of a sample custom tag that has been saved in the file myTag.cfm in 
  20. the snippets directory. You can also save ColdFusion custom tags in the Cfusion\CustomTags 
  21. directory. For more information about using Custom Tags, please refer to 
  22. <i>Developing Web Applications</i>.
  23. </P>
  24. <!--- show the code in the custom tag--->    
  25. <HR size="2" color="#0000A0">
  26. <P>Here is the code in the custom tag.</P>
  27. <CFOUTPUT>#HTMLCodeFormat("<CFSET X = attributes.x>
  28. <CFSET Y = attributes.y>
  29. <CFSET A = attributes.value1>
  30. <CFSET B = attributes.value2>
  31. <CFSET C = attributes.value3>
  32. <CFSET caller.result = x + y + a + b + c>")#
  33. </CFOUTPUT>
  34. <!--- end sample tag --->
  35.  
  36. <CFSET attrCollection1 = StructNew()>
  37.  
  38. <CFSET attrCollection1.value1 = 22>
  39.  
  40. <CFSET attrCollection1.value2 = 45>
  41.  
  42. <CFSET attrCollection1.value3 = 88>
  43.  
  44. <!--- Call the tag with CFMODULE with Name--->
  45. <CFMODULE 
  46.    Template="..\snippets\myTag.cfm"
  47.     X="3"
  48.     attributeCollection=#attrCollection1# 
  49.     Y="4">
  50.  
  51. <!--- show the code --->
  52. <HR size="2" color="#0000A0">
  53. <P>Here is one way in which to invoke the custom tag, 
  54. using the TEMPLATE attribute.</P>
  55. <CFOUTPUT>#HTMLCodeFormat("    <CFMODULE
  56.     Template=""..\snippets\myTag.cfm""
  57.     X=3
  58.     attributeCollection=##attrCollection1##
  59.     Y=4>")#
  60. </CFOUTPUT>    
  61. <P>The result: <CFOUTPUT>#result#</CFOUTPUT>    
  62.  
  63. <!--- Call the tag with CFMODULE with Name--->
  64. <CFMODULE 
  65.     Name="myTag"
  66.     X="3"
  67.     attributeCollection=#attrCollection1# 
  68.     Y="4">
  69.  
  70. <!--- show the code --->
  71. <HR size="2" color="#0000A0">
  72. <P>Here is another way to invoke the custom tag, 
  73. using the NAME attribute.</P>
  74. <CFOUTPUT>#HTMLCodeFormat("    <CFMODULE
  75.     NAME='myTag'
  76.     X=3
  77.     attributeCollection=##attrCollection1##
  78.     Y=4>")#
  79. </CFOUTPUT>    
  80. <P>The result: <CFOUTPUT>#result#</CFOUTPUT>    
  81.  
  82. <!--- Call the tag using the short cut notation --->
  83. <CF_myTag 
  84.     X="3" 
  85.     attributeCollection=#attrCollection1# 
  86.     Y="4">
  87.     
  88. <!--- show the code --->    
  89. <HR size="2" color="#0000A0">
  90. <P>Here is the short cut to invoking the same tag.</P>
  91. <CFOUTPUT>#HTMLCodeFormat("    <CF_myTag 
  92.     X=3 
  93.     attributeCollection=##attrCollection1## 
  94.     Y=4>")#
  95. </CFOUTPUT>    
  96. <P>The result: <CFOUTPUT>#result#</CFOUTPUT></P>    
  97.  
  98.  
  99. </BODY>
  100. </HTML>       
  101.