Steve,

I could have done this just by doing

<cfset application.myUdf = createObject

It defeats the purpose of what I want which is a short translation function
name

Ie

The quick brown fox, jumps over the lazy dog.

Becomes

#tr("The quick brown fox")#, #tr("over the lazy dog")#

Rather than

#application.udf.tr("The quick brown fox")#, #application.udf.tr("over the
lazy dog")#

Regards
Dale Fraser



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Steve Onnis
Sent: Thursday, 29 June 2006 13:50 PM
To: [email protected]
Subject: [cfaussie] Re: Includes


ok

had a bit of a play
this is what i have come up with

<cffunction name="onApplicationStart">
        <cfset this.name = "testApp" />

        <cfinclude template="function.cfm">

        <cfset application.udf = structNew() />

        <cfloop collection="#variables#" item="v">

                <cfif NOT
listFindNoCase("onApplicationStart,onApplicationEnd,onRequestStart,onRequest
End,onSessionStart,onSessionEnd,onError,onRequest", v)>
                        <cfif isCustomFunction(variables[v])>
                                <cfset application.udf[v] = variables[v] />
                        </cfif>
                </cfif>

        </cfloop>

</cffunction>

all your functions will then be available as application.udf.functionName

Steve

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of Andrew Scott
Sent: Thursday, June 29, 2006 1:15 PM
To: [email protected]
Subject: [cfaussie] Re: Includes



Dale,

I am not 100% sure but the onRequest might store it in the request scope.



Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Dale Fraser
Sent: Thursday, 29 June 2006 1:10 PM
To: [email protected]
Subject: [cfaussie] Re: Includes


Yep,

We had a reload option in our apps that fire onApplicationStart. I assume
this is sufficient, but we did this and it didn't help

Regards
Dale Fraser



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Steve Onnis
Sent: Thursday, 29 June 2006 13:07 PM
To: [email protected]
Subject: [cfaussie] Re: Includes


remember you need to restart the application for it to work

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of Dale Fraser
Sent: Thursday, June 29, 2006 12:53 PM
To: [email protected]
Subject: [cfaussie] Re: Includes



Steve,

Adding the tr function into application.cfc doesn't work, can't access it as
application.tr

Chris,

Adding it and then doing the <cfset also didn't work.

Regards
Dale Fraser



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Chris Velevitch
Sent: Thursday, 29 June 2006 12:34 PM
To: [email protected]
Subject: [cfaussie] Re: Includes


On 6/29/06, Dale Fraser <[EMAIL PROTECTED]> wrote:
> We use application.cfc, so how can we include a function on every page
using
> application.cfc model?

Try:-

<cfset variables.tr = this.tr>

in the onRequest method of Application.cfc and have the function
included as a function in the Application.cfc


Chris
--
Chris Velevitch
Manager - Sydney Flash Platform Developers Group
www.flashdev.org.au




















--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to