Technote Details :: Changes to the Application.cfm file in MX Kollection 3.5.0
Issue
Starting with MX Kollection 3.5.0, the Application.cfm file contents has been changed.
Reason
A ColdFusion application generates white spaces for each line of code in the page unless you set the enableCFoutputOnly directive directly in the page, or the Enable Whitespace Management option in the ColdFusion Administrator Panel. This causes errors when generating downloadable files without displaying any page content.
This technical note addresses three situations:
- The site has been already created and the Application.cfm file has been modified.
- The site as been already created and the Application.cfm file is in the default form.
- You are creating a new site.
Solution
Scenario 1: You are updating an older site; a custom application.cfm file exists
Because the file already exists, it will not be overwritten when a server behavior is applied. You have to manually alter the application.cfm file so that any customizations will be kept.
- Open the Application.cfm in Dreamweaver.
- Switch to Code view: from the View menu select Code.
- The existing code should look like the following (this is the default. Your file might differ based on the custom lines you added):
<cfsilent>
<cfapplication sessionmanagement="yes" name="#Hash(GetCurrentTemplatePath())#" setclientcookies="no">
<cfif IsDefined("Session.CFID") AND IsDefined("Session.CFTOKEN")>
<cfset localCFID = Session.CFID>
<cfset localCFToken = Session.CFTOKEN>
<cfelseif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>
<cfset localCFID = Cookie.CFID>
<cfset localCFToken = Cookie.CFTOKEN>
</cfif>
<cfif IsDefined("localCFID") AND IsDefined("localCFToken")>
<cfcookie name="CFID" value="#localCFID#">
<cfcookie name="CFTOKEN" value="#localCFToken#">
</cfif>
</cfsilent> - You must add three new lines: the first two at the beginning and the last one at the end.
<cfsetting enableCFoutputOnly="yes">
<cfapplication sessionmanagement="yes">
<cfsetting enableCFoutputOnly="no">
- The final code will look like the following, for the given sample (the lines you must add are bold):
<cfsilent>
<cfsetting enableCFoutputOnly="yes">
<cfapplication sessionmanagement="yes">
<cfapplication sessionmanagement="yes" name="#Hash(GetCurrentTemplatePath())#" setclientcookies="no">
<cfif IsDefined("Session.CFID") AND IsDefined("Session.CFTOKEN")>
<cfset localCFID = Session.CFID>
<cfset localCFToken = Session.CFTOKEN>
<cfelseif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN")>
<cfset localCFID = Cookie.CFID>
<cfset localCFToken = Cookie.CFTOKEN>
</cfif>
<cfif IsDefined("localCFID") AND IsDefined("localCFToken")>
<cfcookie name="CFID" value="#localCFID#">
<cfcookie name="CFTOKEN" value="#localCFToken#">
</cfif>
<cfsetting enableCFoutputOnly="no">
</cfsilent>
- Save the file and close it. It is now in the latest version.
Scenario 2: You are updating an older site; the Application.cfm is the default one
If you have not made any changes to the Application.cfm, to update it to the latest version, you must:
- Remove the file from the site root (select it in Dreamweaver and press the Delete key).
- Apply a MX Kollection server behavior or wizard. The Application.cfm file will be generated in the latest version.
Scenario 3: You are creating a new site
Because the Application.cfm file does not exist, it will be generated in the correct format when you apply a server behavior or wizard for the first time.