...

View Full Version : Upgrade server from php4 to php5



john125
09-19-2011, 05:23 PM
Hi,

I am moving my website from php4 to php5. I am updating my code.

The website works under php4 but I am getting errors under php5.

The following code is under a page najax_js.ihtml.



{NAJAX}
<script type="text/javascript">
var najaxObj = {NAJAX_OBJ} ;

function callNAJAXFunc()
{
var args = arguments;
var funcName = args[0];
var formName = args[1];
var buildErrorFunc = "najaxObj.on" + funcName + "error = function(error) {\n"+
"alert('Error ' + error.message);\n"+
"return true;\n"+
"}";
eval(buildErrorFunc);
var buildNAJAXFunc = "najaxObj." + funcName + "(najax.html.exportForm('" + formName + "')";
for (var i=2; i<args.length; i++)
{
buildNAJAXFunc += ",";
buildNAJAXFunc += "args["+i+"]";
}
buildNAJAXFunc += ", jsExec)";
alert(buildNAJAXFunc);
eval(buildNAJAXFunc);
}

function jsExec(result)
{
if (result!='true' || result!='false')
{
eval(result);
}
}
</script>




I get an error on the following line:

var najaxObj = {NAJAX_OBJ} ;

Object doesn't support this property or method.

Why does it work on my old server but not on my new server? I would appreciate any help that you can offer.

Regards,

John.

Inigoesdr
09-19-2011, 05:38 PM
That is a JavaScript error. I've never used najax, but it looks like your .ihtml file is either a template that gets parsed elsewhere, or it's PHP and you left some parts out. If it's the former your {NAJAX*} placeholders aren't getting replaced, and that is your issue. If it's the latter you can use something like this in httpd.conf or .htaccess to parse .ihtml as .php:

AddType application/x-httpd-php .ihtml

john125
09-19-2011, 07:04 PM
Hi,

Thanks for your quick reply.

The .ihtml file is a template file. There is nothing else in the file apart from what I have shown you. There is no php in the file.

You state that

"If it's the former your {NAJAX*} placeholders aren't getting replaced, and that is your issue."

I think that this is my issue. How do I ensure that the placeholders are replaced?

Regards,

John.

Inigoesdr
09-19-2011, 07:34 PM
You would have to look at the code, find out where it's being loaded at, and what is missing or broken after that. Have you already checked the error log and/or turned on display_errors/error_reporting so you can see if there is an error message?

john125
09-19-2011, 08:42 PM
Hi,

I have changed my interpreter (netbeans) to interpret ihtml files as php5.

I now get this error in the interpreter -

missing : after property id

on the line

var najaxObj = {NAJAX_OBJ};

What does this mean?

Regards,

John.

john125
09-19-2011, 11:10 PM
I have changed the code to

var najaxObj = <?php ${NAJAX_OBJ} ; ?>;

and I now get the following output



var najaxObj = <?php echo ${"__meta":null,"__size":0,"__class":"mainsite","__url":"index.php","__uid":"44875dca00aa1827bfa3b174a184a08c","__output":null,"__timeout":null,"__clone":function(obj){najax.clone(this, obj)},"__serialize":function(){return najax.serialize(this)},"catchEvent":function(){return najax.catchEvent(this, arguments)},"ignoreEvent":function(){return najax.ignoreEvent(this, arguments)},"postEvent":function(){return najax.postEvent(this, arguments)},"fetchOutput":function(){return this.__output},"setTimeout":function(miliseconds){this.__timeout = miliseconds},"getTimeout":function(){return this.__timeout},"clearTimeout":function(){this.__timeout = null},"fillvoucherorderaddrinfo":function(){return najax.call(this,"fillvoucherorderaddrinfo",arguments)},"addvoucher2basket":function(){return najax.call(this,"addvoucher2basket",arguments)},"registernewmember":function(){return najax.call(this,"registernewmember",arguments)},"_processmember":function(){return najax.call(this,"_processmember",arguments)},"sendcontact":function(){return najax.call(this,"sendcontact",arguments)},"_adderror":function(){return najax.call(this,"_adderror",arguments)},"fillorderaddrinfo":function(){return najax.call(this,"fillorderaddrinfo",arguments)},"memberlogin":function(){return najax.call(this,"memberlogin",arguments)},"removeall4basket":function(){return najax.call(this,"removeall4basket",arguments)},"updatebasketitem":function(){return najax.call(this,"updatebasketitem",arguments)},"getareatowns":function(){return najax.call(this,"getareatowns",arguments)},"reserveinstore":function(){return najax.call(this,"reserveinstore",arguments)},"_reserve1":function(){return najax.call(this,"_reserve1",arguments)},"_reserve2":function(){return najax.call(this,"_reserve2",arguments)},"_reserve3":function(){return najax.call(this,"_reserve3",arguments)},"add2basket":function(){return najax.call(this,"add2basket",arguments)}}; ?>;



The code can now see the NAJAX_OBJ class as evidenced by the output but I get a syntax error. How do I assign the var so that it equals the class.

Regards,

John.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum