Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8958213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:09:39+00:00 2026-06-15T15:09:39+00:00

My application.cfc starts with: <cfcomponent extends=org.corfield.framework> later on void function setupApplication() output=false { I

  • 0

My application.cfc starts with:

<cfcomponent extends="org.corfield.framework">

later on void function setupApplication() output="false" {

I have

// tools
include "initapp.cfm";

initapp.cfm has nothing but functions in it. Things like:

<!--- Helper functions --->
<cfscript>
string function stripHTML(str) output="false" {
return REReplaceNoCase(arguments.str,"<[^>]*>","","ALL");
}

application.stripHTML = stripHTML;

</cfscript>

The nature of the functions is NOT associated with a session. Is there a better way to make functions available globally?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:09:40+00:00Added an answer on June 15, 2026 at 3:09 pm

    If you’re trying to put helper functions together for use in CFCs, one option may be to use the component.cfc file.

    Using the component.cfc file

    All CFCs automatically extend the ColdFusion
    WEB-INF/cftags/component.cfc component. (The WEB-INF directory is in
    the cf_root/wwwroot directory on ColdFusion configured with an
    embedded J2EE server. It is in the cf_root directory when you deploy
    ColdFusion on a J2EE server.) This CFC is distributed as a zero-length
    file. You can use it for any core methods or properties that you want
    all CFCs in your ColdFusion application server instance to inherit.

    Note: When you install a newer version of ColdFusion, the installation
    procedure replaces the existing component.cfc file with a new version.
    Therefore, before upgrading, you should save any code that you have
    added to the component.cfc file, and then copy the code into the new
    component.cfc file.

    If that solution is TOO global you can extend your helper cfc, but it has to be done in every cfc and doesn’t answer your one-time-set-it-and-forget-it idea. See Using CFCs effectively

    If your helper functions are for use in .cfm files, I’d do like Adam suggested. I usually put my helper functions in a “tools” cfc located in a CFC folder and make it an application scoped cfc.

    function onApplicationStart(){
        application.tools = createObject("component", "cfc.tools");
    }
    

    One of my helper functions logs the time it takes to index a solr collection. Using it looks like

    <cfset application.tools.logSolrIndex('collectionName',getTickCount()-start,qFileList.recordCount)>
    

    Last resort:
    If you had to stick with an include for use outside of the application.cfc, I might simply include initapp.cfm onRequest() before you include your page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Application.cfc, I have an onError function that works great for all errors
I have a CFC as singletone object in Application scope. One of the methods
I have: 1. inetpub/wwwroot/ProjectName/Application.cfc 2. inetpub/wwwroot/ProjectName/Admin/Application.cfc I want #2 to extend #1 and override
I'm trying to convert an Application.cfc to script. The original had this: <cfcomponent displayname=Application
In my application I have a header and footer include. In my Application.cfc I've
I have the following web service call: <cfinvoke webservice=#application.capsRemote#card.cfc?wsdl method=purchase returnVariable=retpurchase refreshwsdl=true> <cfinvokeargument name=iCustomer
I have the following Applicaton.cfc <cffunction name=onApplicationStart access=public returntype=Object> <cfset application.dsn = myDB />
I would like to add some code to my Application.cfc onRequestEnd function that, if
I have an application.cfc in folder /wwwRoot/beta/. They have an application.cfm in the root
If I have component level properties in my application.cfc will they get evaluated every

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.