Title: onAppInit 2.6.0 Beta 2
Thread: onAppInit 2.6.0 Beta 2
Forum: Bugs
Conference: ColdBox
User: refriedchicken This method is being called every time a new request is made. I was under the
impression it should be fired by the first request to the site (creating the
application) and then only again if the application has been terminated.
Don't have it running publicly but here is my code:
ON APP INIT:
[code]
<cffunction name="onAppInit" access="public" returntype="void" output="false">
<cfargument name="Event" type="coldbox.system.beans.requestContext">
<!---
ON Application Start Here --->
<cfset application.count = 0>
</cffunction>
[/code]
EVERY TIME DEFAULT IS HIT:
[code]
<cffunction
name="index" access="public" returntype="void" output="false">
<cfargument
name="Event" type="coldbox.system.beans.requestContext">
<!--- Do Your Logic
Here to prepare a view --->
<cfset application.count = application.count + 1>
<cfset Event.setValue("welcomeMessage","Welcome to ColdBox!")>
<!--- Set
the View To Display, after Logic --->
<cfset Event.setView("home")>
</cffunction>
[/code]
HOME VIEW SHOWING THE PROBLEM:
[code]
<cfoutput>
<h1>#Event.getValue("welcomeMessage")#</h1>
<h5>You are running
#getSetting("codename",1)# #getSetting("version",1)#
(#getsetting("suffix",1)#)</h5>
Application Count is #application.count#
</cfoutput>
[/code]
Should I just be using onApplicationStart in the
application.cfc?
http://forums.coldboxframework.com/index.cfm?event=ehMessages.dspMessages&threadid=9BFAE501-FF65-CEF6-652983099F19BB60