Warning, /frameworks/syntax-highlighting/autotests/folding/highlight.cfml.fold is written in an unsupported language. File is not indexed.
0001 <beginfold id='1'><!---</beginfold id='1'> ColdFusion Sample File <endfold id='1'>---></endfold id='1'> 0002 <beginfold id='1'><!---</beginfold id='1'> Source: https://helpx.adobe.com/coldfusion/developing-applications/the-cfml-programming-language/using-arrays-and-structures/structure-examples.html <endfold id='1'>---></endfold id='1'> 0003 0004 <head> 0005 <title>Add New Employees</title> 0006 </head> 0007 0008 <body> 0009 <h1>Add New Employees</h1> 0010 <beginfold id='1'><!---</beginfold id='1'> Action page code for the form at the bottom of this page. <endfold id='1'>---></endfold id='1'> 0011 0012 <beginfold id='1'><!---</beginfold id='1'> Establish parameters for first time through <endfold id='1'>---></endfold id='1'> 0013 <cfparam name="Form.firstname" default=""> 0014 <cfparam name="Form.lastname" default=""> 0015 <cfparam name="Form.email" default=""> 0016 <cfparam name="Form.phone" default=""> 0017 <cfparam name="Form.department" default=""> 0018 0019 <beginfold id='1'><!---</beginfold id='1'> If at least the firstname form field is passed, create 0020 a structure named employee and add values. <endfold id='1'>---></endfold id='1'> 0021 <cfif #Form.firstname# eq ""> 0022 <p>Please fill out the form.</p> 0023 <cfelse> 0024 <cfoutput> 0025 <beginfold id='2'><cfscript</beginfold id='2'>> 0026 employee=StructNew(); 0027 employee.firstname = Form.firstname; 0028 employee.lastname = Form.lastname; 0029 employee.email = Form.email; 0030 employee.phone = Form.phone; 0031 employee.department = Form.department; 0032 <endfold id='2'></cfscript></endfold id='2'> 0033 0034 <beginfold id='1'><!---</beginfold id='1'> Display results of creating the structure. <endfold id='1'>---></endfold id='1'> 0035 First name is #StructFind(employee, "firstname")#<br> 0036 Last name is #StructFind(employee, "lastname")#<br> 0037 EMail is #StructFind(employee, "email")#<br> 0038 Phone is #StructFind(employee, "phone")#<br> 0039 Department is #StructFind(employee, "department")#<br> 0040 </cfoutput> 0041 0042 <beginfold id='1'><!---</beginfold id='1'> Call the custom tag that adds employees. <endfold id='1'>---></endfold id='1'> 0043 <cf_addemployee empinfo="#employee#"> 0044 </cfif> 0045 0046 <beginfold id='1'><!---</beginfold id='1'> The form for adding the new employee information <endfold id='1'>---></endfold id='1'> 0047 <hr> 0048 <form action="newemployee.cfm" method="Post"> 0049 First Name: 0050 <input name="firstname" type="text" hspace="30" maxlength="30"><br> 0051 Last Name: 0052 <input name="lastname" type="text" hspace="30" maxlength="30"><br> 0053 EMail: 0054 <input name="email" type="text" hspace="30" maxlength="30"><br> 0055 Phone: 0056 <input name="phone" type="text" hspace="20" maxlength="20"><br> 0057 Department: 0058 <input name="department" type="text" hspace="30" maxlength="30"><br> 0059 0060 <input type="Submit" value="OK"> 0061 </form> 0062 <br> 0063 </body> 0064 </html> 0065 0066 <cfoutput> 0067 Error. No employee data was passed.<br> 0068 </cfoutput> 0069 <cfexit method="ExitTag"> 0070 <cfelse> 0071 <beginfold id='1'><!---</beginfold id='1'> Add the employee <endfold id='1'>---></endfold id='1'> 0072 <cfquery name="AddEmployee" datasource="cfdocexamples"> 0073 INSERT INTO Employees 0074 (FirstName, LastName, Email, Phone, Department) 0075 VALUES ( 0076 '#attributes.empinfo.firstname#' , 0077 '#attributes.empinfo.lastname#' , 0078 '#attributes.empinfo.email#' , 0079 '#attributes.empinfo.phone#' , 0080 '#attributes.empinfo.department#' ) 0081 </cfquery> 0082 </cfif> 0083 <cfoutput> 0084 <hr>Employee Add Complete 0085 </cfoutput> 0086 0087 <beginfold id='1'><!---</beginfold id='1'> temperature.cfc <endfold id='1'>---></endfold id='1'> 0088 <cfcomponent> 0089 <cffunction name="FtoC" access="public" returntype="numeric"> 0090 <cfargument name="fahrenheit" required="yes" type="numeric" /> 0091 <cfset answer= (fahrenheit - 32)*100/180 /> 0092 <cfreturn answer /> 0093 </cffunction> 0094 </cfcomponent> 0095 <beginfold id='1'><!---</beginfold id='1'> test.cfm <endfold id='1'>---></endfold id='1'> 0096 <cfset fDegrees = 212 /> 0097 <cfinvoke component="temperature" method="FtoC" returnvariable="result"> 0098 <cfinvokeargument name="fahrenheit" value="#fDegrees#" /> 0099 </cfinvoke> 0100 <cfoutput>#fDegrees#°F = #result#°C</cfoutput> <br /> 0101 0102 <cfset person = CreateObject("component", "Person") />