Вопрос

HELP!!

Just migrating a site from one server to another, the coldfusion version is changing from cf8 to cf9 [linux/centos]

this code used to work before:

cfinclude('../SQL/contact.sql.cfc');
form.phone = unFormatPhone(form.phone);
contactID = InsertContact(form);

In the included file is:

<cfcomponent output="false" >
<!--- -------------------------------- insert -------------------------------- --->
<cffunction name="InsertContact" returntype="numeric" output="false" access="public" >

now I get an error when browsing the pages:

Variable INSERTCONTACT is undefined.


The error occurred in /var/www/vhosts/xxxxxx.com/httpdocs/Assets/XHTML/buy-my-car.cfm: line 54
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 232
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 230
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 162
52 :            cfinclude('../SQL/contact.sql.cfc');
53 :            form.phone = unFormatPhone(form.phone);
54 :            contactID = InsertContact(form);
55 :            
56 :            //insert vehicle with app id

What is going on here? the included file is being found, is there some difference between the two versions that is causing this?

Это было полезно?

Решение

Are you sure its being included? try:

include "../SQL/contact.sql.cfc";
form.phone = unFormatPhone(form.phone);
contactID = InsertContact(form);

Другие советы

Well, I'll say first off that I've only worked with CF9, so I can't comment on what you used to be able to do in CF8. But, in CF9 I'm pretty sure you cant use a CFC that way. The closest thing to what you're doing would be transient invocation using <cfinvoke>. See here: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7db3.html

But, also look at instantiating the cfc as an object and then calling methods on that object. I like doing it that way as it reminds me of other languages such as Java and C#.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top