Solved

How can I call a cffunction that is saved on a .cfm page from a .cfm page?

Posted on 2013-10-25
2
1,394 Views
Last Modified: 2013-10-25
I have a cffunction that was written with a .cfm extension page instead of .cfc. I want to call that function but I'm not sure how. Is it the same way as a .cfc?

<cfset myCFC = createObject( 'component', 'path.to.my.cfm.page.with.function' ) />

Did not seem to work for me but if somebody else can verify that would work or let me know a different way that would be great.

Thanks,

Brian
0
Comment
Question by:brihol44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 200 total points
ID: 39602199
the createobject is used for a cfc only.  The function inside of a .cfm file is just a function, you call it directly (no create object).

Just cfinclude the page holding the function and call it...


<cfset theResult = myFunction(this, that)>
0
 

Author Closing Comment

by:brihol44
ID: 39602227
ok, that makes sense. I just wondered if there was another way but that works.

thanks!
0

Featured Post

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question