Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Upgrade server from php4 to php5

    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.

    Code:
    {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.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    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:
    Code:
    AddType application/x-httpd-php .ihtml

  • #3
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by john125; 09-19-2011 at 08:04 PM. Reason: typo

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    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?

  • #5
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have changed the code to

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

    and I now get the following output

    Code:
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •