But the view function is not application scoped in one.cfc right? And since it is not application scoped , how it is accessible in cfm pages?
I shall repeat what I said:
- store the function as a variable in application scope, it will be available in all CFM pages of the application.
- test the example I gave you, and you will see it for yourself.
Some more code examples, in case you need help to set up a test:
TestComponent.cfc
<cfcomponent>
<cffunction name="init" output="false">
<cfset application.globalView = variables.view>
</cffunction>
<cffunction name="view" output="false">
<cfargument name="callerName">
<cfreturn "Hi, " & arguments.callerName & "!">
</cffunction>
</cfcomponent>
testcode1.cfm
<!---
CFM page is in same folder as the component.
After this line runs, the function View() will be
universally available throughout the application.
--->
<cfset testObject = new TestComponent()>
testcode2.cfm
<!---
Run this page somewhere else in the application,
some minutes later.
--->
<cfoutput>#application.globalView("Abdul L Koyappayil")#</cfoutput>