Adding CFWheels Applications as "Custom Script" elements in the CommonSpot CMS
Posted by Quinn Madson | Posted in | Posted on 1:43 PM
0
It appears that CommonSpot (version 5, at least) ignores Application.cfc files when using a custom script in the same directory. In CF Wheels, Application.cfc is used to setup the entire framework.
Here is what I did to get it working:
- Put your CF Wheels application in the customcf/ subdirectory
- Rename Application.cfc to application.cfc (This is done to prevent the application from being initialized twice if accessed outside the CMS.)
- Edit the index.cfm at the root of the application directory:
<!--- Manually instantiate the application.cfc --->
<cfset server.railo = structNew()>
<cfset server.railo.version = "fake version">
<!--- If this is the first time the application has run, call the onApplicationStart method --->
<cfset app = CreateObject("component","application")>
<!--- Call the onRequestStart method and pass the current page as a parameter --->
<cfif not structKeyExists(application, "wheels")>
<cfset app.onApplicationStart()>
</cfif>
<!--- Call the onRequestStart method and pass the current page as a parameter --->
<cfset app.onRequestStart(cgi.script_name)>
<!--- This is the only original line in the file --->
<cfinclude template="wheels/index.cfm">
Comments (0)
Post a Comment