| Cold Fusion API | ||
|
cfset search codefetch
Defines a ColdFusion variable. If the variable exists, this tag sets it to the specified value. ...
cfsetting search codefetch
Controls aspects of page processing, such as the output of HTML code in pages. ...
ArraySwap search codefetch
Swaps array values of an array at specified positions. This function is more efficient than multiple cfset tags. ...
| ||
| ||
23/notRB.cfm (16 lines) 9 ---> 10 11 <cfset loginRB=structNew()> 12 <cfset loginRB.en_US.loginFormTitle="Please login"> 13 <cfset loginRB.en_US.userNameLabel="user name"> 14 <cfset loginRB.en_US.passwordLabel="password"> 15 <cfset loginRB.en_US.loginButton="login"> 16 <cfset loginRB.en_US.clearButton="clear"> 18/Application.cfc (11 lines) 2 3 <cfcomponent> 4 <cfset This.name = "Chapter18"> 5 6 <cffunction name="OnApplicationStart"> 7 <cfset Application.urlRoot = "/Chapter18"> 8 <cfset Application.dbDSN = "Chapter18"> 9 </cffunction> 10 </cfcomponent> 18/Auth.cfm (54 lines) 26 27 <!--- Loop over the list of required roles ---> 28 <cfset inRole = FALSE> 29 <cfloop list="#Attributes.roles#" index="currentRole"> 30 <cfif IsUserInRole(currentRole)> 31 <!--- If Attributes.memberOf is "AnyOfTheseRoles", and there is a match, 32 the user may access content. ---> 33 <cfset inRole = TRUE> 34 <cfbreak> 35 </cfif> 18/Bidirectional/IntelligentInput.cfm (30 lines) 10 <cfassociate basetag="CF_INTELLIGENTFORM"> 11 12 <cfset parentData = GetBaseTagData("CF_INTELLIGENTFORM")> 13 14 <cfdump var="#parentData#" 18/DisplayField.cfm (54 lines) 14 15 <!--- Make the parent tag's attributes available to this child tag ---> 16 <cfset parentData = GetBaseTagData("CF_DISPLAYFORM")> 17 18 <cfif parentData.Attributes.formStatus EQ "Preparing"> | ||
| ||
ows/10/details3.cfm (87 lines) 8 9 <!--- Movie list page ---> 10 <cfset list_page="movies8.cfm"> 11 12 <!--- Make sure FilmID was passed ---> ows/10/dynamicsql.cfm (23 lines) 7 8 <!--- Create FilmID variable ---> 9 <cfset FilmID=1> 10 11 <!--- Get a movie from database ---> ows/10/frame_details.cfm (72 lines) 28 29 <!--- Build image paths ---> 30 <cfset image_src="../images/f#movie.FilmID#.gif"> 31 <cfset image_path=ExpandPath(image_src)> 32 33 <!--- Create HTML page ---> ows/10/movies7.cfm (42 lines) 28 <!--- What color should this row be? ---> 29 <cfif CurrentRow MOD 2 IS 1> 30 <cfset bgcolor="MediumSeaGreen"> 31 <cfelse> 32 <cfset bgcolor="White"> 33 </cfif> 34 <tr bgcolor="#bgcolor#"> ows/11/browse.cfm (57 lines) 1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())> 2 <cfparam name="PageNum_movies" default="1"> 3 <cfinvoke 4 component="ows.11.movies" 5 method="List" 6 returnvariable="movies"> 7 </cfinvoke> 8 <cfset MaxRows_movies=10> 9 <cfset StartRow_movies=Min((PageNum_movies-1)*MaxRows_movies+1,Max(movies.RecordCount,1))> 10 <cfset EndRow_movies=Min(StartRow_movies+MaxRows_movies-1,movies.RecordCount)> 11 <cfset TotalPages_movies=Ceiling(movies.RecordCount/MaxRows_movies)> 12 <cfset QueryString_movies=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))> 13 <cfset tempPos=ListContainsNoCase(QueryString_movies,"PageNum_movies=","&")> 14 <cfif tempPos NEQ 0> 15 <cfset QueryString_movies=ListDeleteAt(QueryString_movies,tempPos,"&")> 16 </cfif> 17 | ||
| ||
ch11/xmldom10.cfm (27 lines) 8 9 10 <cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> 11 12 13 <cfset myXMLDOM = XMLParse(variables.originalXMLString)> 14 15 <cfscript> ch11/xmldom11.cfm (31 lines) 8 9 10 <cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> 11 12 13 <cfset myXMLDOM = XMLParse(variables.originalXMLString)> 14 15 <cfscript> ch11/xmldom12.cfm (29 lines) 8 9 10 <cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> 11 12 13 <cfset myXMLDOM = XMLParse(variables.originalXMLString)> 14 15 <cfscript> ch11/xmldom13.cfm (28 lines) 25 <cffile action="read" variable="myXSL" file="#expandPath('.')#\figsXSL.xsl"> 26 27 <cfset transformedXML = XMLTransform(variables.myXMLDOM, variables.myXSL)> 28 <cfoutput>#variables.transformedXML#</cfoutput> ch11/xmldom3.cfm (35 lines) 14 </cfcatch> 15 </cftry> 16 <cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> 17 18 <cftry> 19 <cfset myXMLDOM = XMLParse(variables.originalXMLString)> 20 <cfcatch> 21 <h3>Error parsing XML!</h3> | ||
| ||
ProgrammingCF/10/10-25.cfm (41 lines) 18 <!--- If the parent is a category, set image to Folder. If it is a link, set the image to Document ---> 19 <cfif LinkURL is ""> 20 <cfset Image="Folder"> 21 <cfelse> 22 <cfset Image="Document"> 23 </cfif> 24 ProgrammingCF/10/recurse.cfm (41 lines) 18 <!--- If the parent is a category, set image to Folder. If it is a link, set the image to Document ---> 19 <cfif LinkURL is ""> 20 <cfset Image="Folder"> 21 <cfelse> 22 <cfset Image="Document"> 23 </cfif> 24 ProgrammingCF/11/11-23.cfm (53 lines) 1 <!--- Set URL.ID=1. Normally, this value would come as a URL parameter or 2 form post (then it would be form.ID) ---> 3 <cfset URL.ID = 1> 4 5 <!--- Retrieve the full record of the employee whose ID is specified. ProgrammingCF/11/11-27.cfm (109 lines) 1 <!--- Initialize a variable called Continue to control the transaction ---> 2 <cfset Continue = true> 3 4 <!--- Begin transaction ---> ProgrammingCF/11/11-3.cfm (32 lines) 7 8 <!--- Initialize the StartNewRow variable as true ---> 9 <cfset StartNewRow = true> 10 11 <h2>Two column output sorted left to right</h2> | ||
| ||
ColdFusion MX Developer's Cookbook/chapter01/alphabet.cfm (7 lines) 1 <cfset start = Asc('A')> 2 <cfset end = start + 25> 3 <cfloop from="#start#" to="#end#" index="i"> 4 <cfset charUpper = Chr(i)> 5 <cfset charLower = Chr(i+32)> 6 <cfoutput>#charUpper# --> #charLower#<br></cfoutput> 7 </cfloop> ColdFusion MX Developer's Cookbook/chapter01/copyright.cfm (2 lines) 1 <cfset string = "Copyright "&Chr(169)&" 2002"> 2 <cfoutput>#string#</cfoutput> ColdFusion MX Developer's Cookbook/chapter01/encrypt.cfm (8 lines) 1 <cfset theString = "ColdFusion"> 2 <!--- I also use "1234" for my luggage combination ---> 3 <cfset key = "key"> 4 5 <cfset encryptedString = Encrypt(theString,key)> 6 <cfoutput>Encrypted String: "#encryptedString#"</cfoutput><br> 7 <cfset decryptedString = Decrypt(encryptedString,key)> 8 <cfoutput>Decrypted String: "#decryptedString#"</cfoutput> ColdFusion MX Developer's Cookbook/chapter01/hash.cfm (20 lines) 2 <body> 3 <cfif isdefined("submitted")> 4 <cfset orig_password = "password"> 5 <cfset hashedPw = Hash(orig_password)> 6 <cfset hashedAttempt = Hash(password)> 7 <cfif hashedPw is hashedAttempt> 8 You entered the correct password. ColdFusion MX Developer's Cookbook/chapter01/readFile.cfm (6 lines) 1 <cfset filename = GetDirectoryFromPath(GetCurrentTemplatePath())&"data.txt"> 2 <cffile action="read" file="#filename#" variable="data"> 3 | ||
| ||
editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/applicationextract.cfm (36 lines) 14 <CFIF not isdefined("URL.DebugMode")> 15 <CFIF isdefined("session.DebugMode")> 16 <CFSET Request.DebugMode = Session.DebugMode> 17 </CFIF> 18 <CFELSE> 19 <!--- they did define it on the URL, so that overrides the session. 20 We now set it in the session for the next page load. ---> 21 <CFSET Session.DebugMode = URL.DebugMode> 22 <CFSET Request.DebugMode = URL.DebugMode> 23 </CFIF> 24 </CFLOCK> editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/createUser.cfm (19 lines) 10 Description: Create and Display a User 11 ---> 12 <CFSET GetUser = structNew()> 13 <CFSET GetUser.Name = "Ken"> 14 <CFSET GetUser.Hobby = "Improvisational Comedy"> 15 <CFSET GetUser.EmployeeID = "123123"> 16 <CFOUTPUT>Hello, #GetUser.Name#</CFOUTPUT> 17 editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/mcMain.cfm (17 lines) 10 ---> 11 12 <CFSET MyName = "Ken"> 13 <CFOUTPUT>mcMain: Starting.<BR></CFOUTPUT> 14 <CFINCLUDE TEMPLATE="mcIncluded.cfm"> editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/monitoring.cfm (17 lines) 8 <CFLOG application="yes"> 9 <CFERROR type="monitor" template="monitortemplate.cfm"> 10 <CFSET stX = structNew()> 11 <CFSET stX.a = "test"> 12 <CFSET stX.b = "yo"> 13 <CFLOOP collection="#stX#" item="Y"> 14 <CFOUTPUT>#y#</CFOUTPUT> editors/Web Materials/2 For Lotus Notes/Code Files/4029code/4029ch02/mycfc.cfc (12 lines) 7 <cffunction name="myFunction" access="remote" returntype="string"> 8 <cfargument name="myArgument" type="string" required="true"> 9 <cfset myResult="MyCFC Result =" & arguments.myArgument & "<BR>"> 10 <cfreturn myResult> 11 </cffunction> | ||
| ||
Chapter05/EmpList_Navbar_Page66.cfm (66 lines) 1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())> 2 <cfparam name="PageNum_q_EmployeeList" default="1"> 3 <cfquery name="q_EmployeeList" datasource="exampleapps"> 4 SELECT FirstName, LastName FROM tblEmployees 5 </cfquery> 6 <cfset MaxRows_q_EmployeeList=10> 7 <cfset StartRow_q_EmployeeList=Min((PageNum_q_EmployeeList-1)*MaxRows_q_EmployeeList+1,Max(q_EmployeeList.RecordCount,1))> 8 <cfset EndRow_q_EmployeeList=Min(StartRow_q_EmployeeList+MaxRows_q_EmployeeList-1,q_EmployeeList.RecordCount)> 9 <cfset TotalPages_q_EmployeeList=Ceiling(q_EmployeeList.RecordCount/MaxRows_q_EmployeeList)> 10 <cfset QueryString_q_EmployeeList=Iif(CGI.QUERY_STRING NEQ "",DE("&"&CGI.QUERY_STRING),DE(""))> 11 <cfset tempPos=ListContainsNoCase(QueryString_q_EmployeeList,"PageNum_q_EmployeeList=","&")> 12 <cfif tempPos NEQ 0> 13 <cfset QueryString_q_EmployeeList=ListDeleteAt(QueryString_q_EmployeeList,tempPos,"&")> 14 </cfif> 15 <html> Chapter05/EmpList_Table_Restrict_Page62.cfm (29 lines) 3 SELECT FirstName, LastName FROM tblEmployees 4 </cfquery> 5 <cfset MaxRows_q_EmployeeList=10> 6 <cfset StartRow_q_EmployeeList=Min((PageNum_q_EmployeeList-1)*MaxRows_q_EmployeeList+1,Max(q_EmployeeList.RecordCount,1))> 7 <cfset EndRow_q_EmployeeList=Min(StartRow_q_EmployeeList+MaxRows_q_EmployeeList-1,q_EmployeeList.RecordCount)> 8 <cfset TotalPages_q_EmployeeList=Ceiling(q_EmployeeList.RecordCount/MaxRows_q_EmployeeList)> 9 <html> 10 <head> Chapter07/DynamicFormObject_Page93.cfm (157 lines) 1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())> 2 <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1"> 3 <cfquery datasource="exampleapps"> Chapter07/InsEmpManualwithIns_Page106.cfm (71 lines) 1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())> 2 <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "Ins_Emp"> 3 <cfquery datasource="exampleapps"> Chapter07/Insert_Emp_Page90.cfm (148 lines) 1 <cfset CurrentPage=GetFileFromPath(GetTemplatePath())> 2 <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1"> 3 <cfquery datasource="exampleapps"> | ||
| ||
Office.cfc (29 lines) 1 <cfcomponent hint="I am an Office"> 2 3 <cfset this.pricePerLOC = 6.34> 4 <cfset this.name = "DUL - Atlanta"> 5 6 <cffunction name="getPricePerLOC"> | ||
| ||
ApplicationFiles/ErrorTest.cfm (257 lines) 1 <cfsetting enablecfoutputonly="Yes"> 2 <!---------------------------------------------------------------- 3 Template: .cfm ApplicationFiles/Flash/getDocList.cfm (18 lines) 4 </cfscript> 5 6 <cfset output = "hello from getDocList <br>"> 7 <cfloop collection="#CGI#" item="currProp"> 8 <cfset output = output & currProp & " = " & CGI[currProp] & "<br>"> 9 </cfloop> 10 <cfset output = output & "<hr>"> 11 12 <!--- <cffile action = "write" ApplicationFiles/Flash/getHierQuery.cfm (25 lines) 1 <cfif ArrayLen(flash.params)> 2 <cfset flag = "Yes"> 3 <cfset docID = flash.params[1]> 4 <cfelse> 5 <cfset flag = "No"> 6 <cfset docID = 1> 7 </cfif> 8 <cfset output = "flag = #flag# hello2 from getHierQuery.cfm; <br> docID = #docID# <br> isDefined flash.params[1] = <br>"> 9 10 <cfloop collection="#CGI#" item="currProp"> 11 <cfset output = output & currProp & " = " & CGI[currProp] & "<br>"> 12 </cfloop> 13 <cfset output = output & "<hr>"> 14 15 <cffile action = "write" ApplicationFiles/Flash/getmessage.cfm (3 lines) 1 2 <CFSET flash.result = "hello from cf"> 3 ApplicationFiles/application.cfm (111 lines) 1 <CFSETTING ENABLECFOUTPUTONLY="Yes"> 2 <!------------------------------------------------ 3 File name: application.cfm | ||
| ||
application.cfm (3 lines) 1 2 <!--- datasource name used for application ---> 3 <CFSET DSN = "hrp"> code.cfm (114 lines) 11 <TABLE BORDER="1" CELLPADDING="6" WIDTH="650" ALIGN="center"><TR><TD> 12 <!--- get current path of pages ---> 13 <CFSET file_path = GetDirectoryFromPath(GetCurrentTemplatePath())> 14 <!--- default file name to nothing ---> 15 <CFPARAM NAME="file_name" DEFAULT=""> 16 <CFPARAM NAME="additional_file" DEFAULT=""> 17 18 <!--- detemine the file name to retrieve ---> 19 <CFSWITCH EXPRESSION="#url.action#"> 20 <!--- organization ---> 21 <CFCASE VALUE="org"> 22 <CFSET file_name = "organization.inc"> 23 </CFCASE> 24 <!--- index ---> 25 <CFCASE VALUE="index"> 26 <CFSET file_name = "index.inc"> 27 </CFCASE> 28 <!--- filter ---> 29 <CFCASE VALUE="filter"> 30 <CFSET file_name = "filter.inc"> 31 </CFCASE> 32 <!--- results ---> 33 <CFCASE VALUE="results"> 34 <CFSET file_name = "results.inc"> 35 </CFCASE> 36 <!--- department ---> 37 <CFCASE VALUE="dept"> 38 <CFSET file_name = "department.inc"> 39 <CFSET additional_file = "functions.inc"> 40 </CFCASE> 41 <!--- detail ---> 42 <CFCASE VALUE="detail"> 43 <CFSET file_name = "detail.inc"> 44 <CFSET additional_file = "functions.inc"> 45 </CFCASE> 46 <!--- xml ---> 47 <CFCASE VALUE="xml"> 48 <CFSET file_name = "xml.inc"> 49 <CFSET additional_file = "employee.xsl"> 50 </CFCASE> 51 <!--- webservices ---> | ||
| ||
4124ch02/c0202.cfm (17 lines) 9 10 <cfif not IsDefined("url.name")> 11 <cfset url.name = "World"> 12 </cfif> 13 4124ch02/c0203.cfm (17 lines) 8 <body> 9 10 <cfset name="World"> 11 12 <cfoutput> 4124ch04/c0401.cfm (15 lines) 6 <body> 7 8 <cfset name="Guy Rish"> 9 10 <cfoutput> 4124ch09/cfinclude.cfm (6 lines) 1 <cfset chosen=0> 2 <cfinclude template="head09.cfm"> 3 <hr> 4124ch11/c1106.cfm (52 lines) 16 17 <!--- Create a variable to hold the number of rows returned. ---> 18 <cfset NumRecords = RowCount.RowsSelected> 19 20 <!--- Perform the update. ---> | ||
| ||
au/com/tatam/Chat/dialog/Request.cfc (80 lines) 18 19 <cfcomponent name="Request" hint="Manages the requests from the FlashChatUI"> 20 <cfset DSN_Session ="Chat"> 21 <cfset DSN_SessionDBType ="ODBC"> 22 <!---******************************************************************************* 23 o Function name: createChatRequest au/com/tatam/Chat/session/Session.cfc (268 lines) 19 <cfcomponent name="Session" hint="controlls the session"> 20 <!--- **************************** ---> 21 <cfset DSN_Session ="Chat" /> 22 <cfset DSN_SessionDBType ="ODBC" /> 23 <!---******************************************************************************* 24 o Function name: setNewSession au/com/tatam/Database/query.cfc (291 lines) 24 *******************************************************************************************************---> 25 <CFCOMPONENT > 26 <cfsetting enablecfoutputonly="yes"> 27 <!--- *********** CheckMinimumAttributes Function ********************* ---> 28 <CFFUNCTION NAME="CheckMinimumAttributes" ACCESS="PRIVATE" > au/com/tatam/User/cfcTemplateIncludes/UserAddress.cfm (43 lines) 18 Description : Comments 19 *******************************************************************************************************---> 20 <cfset arguments = "#attributes.arguments#" /> 21 <cftry> 22 au/com/tatam/User/cfcTemplateIncludes/createUser.cfm (106 lines) 16 Description : Comments 17 *******************************************************************************************************---> 18 <cfset arguments = "#attributes.arguments#" /> 19 <cftry> 20 | ||
| ||
AdvancedCF/Chapter01/listing1.cfm (93 lines) 1 <CFSETTING enablecfoutputonly="yes"> 2 3 <!--- did the user ask to swap locales? ---> 4 <CFIF isDefined("form.newLocale")> 5 <CFSET client.primeLangauge=Left(form.newLocale,2)> 6 <CFSET client.locale=form.newLocale> 7 </CFIF> 8 9 <CFIF isDefined("client.primeLanguage") AND isDefined("client.locale")> 10 <CFSET primeLanguage=client.primeLanguage> 11 <CFSET locale=client.locale> 12 <CFELSE> 13 <!--- if not, lets see what language their browser is using ---> 14 15 <!--- only care about languages, ignore the rest of this string ---> 16 <CFSET strPos=FindNoCase(";", cgi.HTTP_ACCEPT_LANGUAGE,1)-1> 17 <CFSET theseLanguages=Left(cgi.HTTP_ACCEPT_LANGUAGE,strPos)> 18 <!-- more than one language installed? even non-English users will very 19 often have US or other English languages installed ---> 20 <CFIF variables.theseLanguages CONTAINS ","> <!--- yup more than one language ---> 21 <!--- we'll assume that the default language is the 1st in the list ---> 22 <CFSET locale=ListFirst(theseLanguages)> 23 <CFELSE> <!--- lucky us, only one language ---> 24 <CFSET locale=theseLanguages> 25 </CFIF> 26 AdvancedCF/Chapter01/listing11.cfm (49 lines) 7 <!--- this will be common to all locales ---> 8 <!--- what day? ---> 9 <CFSET thisDay=DayOfWeek(now())> 10 <!--- what month? ---> 11 <CFSET theMonth=Month(Now())> 12 <CFSET theMonths=StructFind(theMonths,defaultLanguage)> 13 <CFSET thisMonth=theMonths[theMonth]> 14 <!--- get the year in this locale ---> 15 <cf_LocaleYear yearAD="#year(Now())#" calendar="#getLocaleInfo.calType#"> AdvancedCF/Chapter01/listing13.cfm (68 lines) 1 <CFSETTING enablecfoutputonly="yes"> 2 <!--- if this fellow is an old user, we should have him in our client db ---> 3 <CFIF isDefined("client.primeLanguage")> 4 <CFSET primeLanguage=client.primeLanguage> 5 <CFELSE><!--- if not, lets see what language their browser is using ---> 6 <!--- only care about languages, ignore the rest of this string ---> 7 <CFSET strPos=FindNoCase(";", cgi.HTTP_ACCEPT_LANGUAGE,1)-1> 8 9 <CFIF strPos LTE 0> 10 <CFSET theseLanguages=CGI.HTTP_ACCEPT_LANGUAGE> 11 <CFELSE> 12 <CFSET theseLanguages=Left(cgi.HTTP_ACCEPT_LANGUAGE,strPos)> 13 </CFIF><!-- more than one language installed? even non-English users will very 14 often have US or other English languages installed ---> 15 <CFIF variables.theseLanguages CONTAINS ","> <!--- more than one language ---> 16 <!--- the default language is the 1st in the list ---> 17 <CFSET defaultLanguage=ListFirst(theseLanguages)> 18 <CFELSE> <!--- lucky us, only one language ---> 19 <CFSET defaultLanguage=theseLanguages> 20 </CFIF> 21 AdvancedCF/Chapter01/listing14.cfm (110 lines) 12 13 <!--- now comes the tricky part, loading the structures ---> 14 <CFSET formWords = StructNew()> 15 <CFOUTPUT QUERY="getWords" GROUP="countryCode"> 16 <CFSET "formWords.#countryCode#"=StructNew()> 17 <CFOUTPUT> 18 <CFSET "formWords.#countryCode#.#formItem#"="#itemString#"> 19 </CFOUTPUT> 20 </CFOUTPUT> AdvancedCF/Chapter01/listing15.cfm (84 lines) 1 <CFSETTING enablecfoutputonly="yes"> 2 <CFSET start=evaluate("application.menuWords.#session.primeLanguage#.start")> 3 <CFSET bugs=evaluate("application.menuWords.#session.primeLanguage#.bugs")> 4 <CFSET forums=evaluate("application.menuWords.#session.primeLanguage#.forums")> 5 <CFSET manual=evaluate("application.menuWords.#session.primeLanguage#.manual")> 6 <CFSET updates=evaluate("application.menuWords.#session.primeLanguage#.updates")> 7 <CFSET comments=evaluate("application.menuWords.#session.primeLanguage#.comments")> 8 <CFSET mail=evaluate("application.menuWords.#session.primeLanguage#.mail")> 9 <CFSET elist=evaluate("application.menuWords.#session.primeLanguage#.elist")> 10 <CFSET help=evaluate("application.menuWords.#session.primeLanguage#.help")> 11 <CFSET orderCD=evaluate("application.menuWords.#session.primeLanguage#.orderCD")> 12 <CFSETTING enablecfoutputonly="No"> 13 <!-- This document was created with HomeSite v2.0 --> | ||
| ||
Chapter10/10-22.cfm (47 lines) 4 so we set the ParentItemID to 0. ---> 5 <CFIF ISDEFINED("Attributes.ParentItemID")> 6 <CFSET ParentItemID = Attributes.ParentItemID> 7 <CFELSE> 8 <CFSET ParentItemID = 0> 9 </CFIF> 10 Chapter11/11-23.cfm (38 lines) 1 <!--- set ID = 1. Normally, this value would come from a form post or as 2 a URL parameter ---> 3 <CFSET ID = 1> 4 5 <!--- retrieve the full record of the employee whose ID is specified. Chapter11/11-27.cfm (96 lines) 1 <!--- Initialize a variable called Continue to control the transaction ---> 2 <CFSET Continue = "Yes"> 3 4 <!--- begin transaction ---> Chapter11/11-3.cfm (30 lines) 8 <H2>Two column output sorted left to right</H2> 9 <!--- initialize the STARTNEWROW variable as True ---> 10 <CFSET StartNewRow = True> 11 12 <!--- The CFPROCESSING tag suppresses extra whitespace as much as possible. Chapter11/11-4.cfm (62 lines) 9 10 <!--- Columns sets the total number of output columns. ---> 11 <CFSET Columns = 3> 12 <CFSET CurrentColumn = 0> 13 <CFSET RowCompleted = 0> 14 <!--- Set the total number of rows equal to the number of records divided by 15 the number of columns. ---> 16 <CFSET Rows=Int(GetEmployeeInfo.RecordCount/Columns)> 17 <!--- Set a variable to hold the number of columns with extra records ---> 18 <CFSET OddColumns = GetEmployeeInfo.RecordCount MOD Columns> 19 <!--- if there are columns with extra records, increase the number of rows by 20 one ---> 21 <CFIF OddColumns NEQ 0> 22 <CFSET Rows = IncrementValue(Rows)> 23 </CFIF> 24 <CFSET Increment = IncrementValue(Int(GetEmployeeInfo.RecordCount/Columns))> 25 26 <H2>Multicolumn Query Output Sorted Top to Bottom</H2> | ||
| ||
ProCF/Ch14/TimeCFSETvsCFSCRIPT.cfm (40 lines) 1 <!--- CFSET ---> 2 <!--- Get time to carry out loop ---> 3 <cfset loopstart = getTickCount() > 4 <cfloop index="i" from="1" to="1000"></cfloop> 5 <cfset looptime = getTickCount() - loopstart> 6 7 <!--- Carry out variable assignment---> 8 <cfset array = ArrayNew(1) > 9 <cfset temp = ArraySet(array,1,1000,"")> 10 <cfset start = getTickCount()> 11 <cfloop index="i" from="1" to="1000"> 12 <cfset array[i] = i> 13 </cfloop> 14 15 <!--- Get time to carry out variable assignment ---> 16 <cfset finish = getTickCount() - start - looptime> 17 Time taken to set 1000 variables using CFSET:<cfoutput> #finish# </cfoutput>milliseconds 18 <p></p> 19 ProCF/Ch14/TimeCFSETvsCFSCRIPT2.cfm (15 lines) 1 <!--- CFLOOP INDEX ---> 2 <cfset start = getTickCount()> 3 <cfloop index="i" from=1 to=10000> 4 </cfloop> 5 <cfset finish = getTickCount() - start> 6 The time taken to loop 10000 times using CFLOOP is <cfoutput> #finish# </cfoutput>milliseconds 7 <P> ProCF/Ch04/helloworld.cfm (22 lines) 7 8 <!--- Set a variable called name with the value of Ryan ---> 9 <cfset name = "Ryan"> 10 <br><br> 11 ProCF/Ch05/variables.cfm (11 lines) 1 <cfset CapitalOfUnitedKingdom = "London"> 2 <cfset Favorite_Food = "Pasta"> 3 <cfset Price = 24.99> 4 <cfset Important_Day = "8th March 2001"> 5 6 <cfoutput> ProCF/Ch06/a_doregister.cfm (128 lines) 98 <!--- If it doesn't, send them back to the form ---> 99 <cfinclude template="register.cfm"> 100 <CFSET test="foo"> 101 <cfabort> 102 </cfif> | ||
| ||
AppraisalForm.CFM (91 lines) 15 <CFIF get_Appraisal_ID.RECORDCOUNT GT 0> 16 <CFOUTPUT QUERY = "get_Appraisal_ID"> 17 <CFSET varAppID = #AppID#> 18 <CFSET SESSION.CurrentAppID = #AppID#> 19 <CFSET varAppraisalPeriod = #AppraisalPeriod#> 20 <CFSET varAppraisalYear = #AppraisalYear#> 21 <CFSET varReviewerCode = #ReviewerCode#> 22 </CFOUTPUT> 23 AppraisalReviewerForm.CFM (65 lines) 15 <CFIF get_Appraisal_ID.RECORDCOUNT GT 0> 16 <CFOUTPUT QUERY = "get_Appraisal_ID"> 17 <CFSET varAppID = #AppID#> 18 <CFSET SESSION.CurrentAppID = #AppID#> 19 <CFSET varAppraisalPeriod = #AppraisalPeriod#> 20 <CFSET varAppraisalYear = #AppraisalYear#> 21 </CFOUTPUT> 22 <cfinvoke component="ConvertQuarterToText" method="TextQtr" returnVariable="QtrInText" QtrNumber=#varAppraisalPeriod#> CallValidate.cfm (68 lines) 1 <cfswitch expression="#Form.country#"> 2 <cfdefaultcase> 3 <cfset SESSION.DSN = "ElectricComp"> 4 <cfset SESSION.Country = "USA"> 5 </cfdefaultcase> 6 <cfcase value="USA"> 7 <cfset SESSION.DSN = "ElectricComp"> 8 <cfset SESSION.Country = "USA"> 9 </cfcase> 10 <cfcase value="Austria"> 11 <cfset SESSION.DSN = "ElectricComp"> 12 <cfset SESSION.Country = "Austria"> 13 </cfcase> 14 <cfcase value="Brazil"> 15 <cfset SESSION.DSN = "ElectricComp"> 16 <cfset SESSION.Country = "Brazil"> 17 </cfcase> 18 </cfswitch> ConvertQuarterToText.cfc (23 lines) 4 <cfswitch expression=#arguments.QtrNumber#> 5 <cfdefaultcase> 6 <cfset myResult = "Jan-Mar"> 7 </cfdefaultcase> 8 <cfcase value=1> 9 <cfset myResult = "Jan-Mar"> 10 </cfcase> 11 <cfcase value="2"> 12 <cfset myResult = "Apr-June"> 13 </cfcase> 14 <cfcase value="3"> 15 <cfset myResult = "July-Sep"> 16 </cfcase> 17 <cfcase value="4"> 18 <cfset myResult = "Oct-Dec"> 19 </cfcase> 20 </cfswitch> ProcessReviewerMain.cfm (131 lines) 16 </CFQUERY> 17 <CFIF FindAppraisal.RECORDCOUNT EQ 0> 18 <cfset varHeaderFlag = "Yes"> 19 <cfset varTargetCount = 1> 20 <CFLOOP INDEX = "element" FROM = "1" TO="6"> 21 <cfset varTarget = Evaluate("Form.#element#")> 22 <CFIF varTarget GT ""> 23 <CFIF varHeaderFlag EQ "Yes"> | ||