Welcome to TheCredence.com - You may like to subscribe to our RSS feed to stay updated.
Recently Yahoo has released THE KILLER APP for Javascript (and AJAX as well) applications and the internet- namely the Yahoo User Interface engine (YUI). When combined with PHP this can create a very rich and fast application interface, one that easily parallels the experience of a desktop program. You can Grab YUI from here: http://developer.yahoo.com/yui/
Now, one of the very few flaws in this engine is that documentation doesn’t come right out and tell you how to use PHP with it. Instead, you have to dig around and try and put together what you already know about web-programming, and also change your thought on how web applications are built and run.
YUI has a connection manager utility, that we will use to connect and program with PHP. The way the YUI works, it is best to create a separate PHP file for the code that runs on the server, and a separate file that would run the actual YUI code.
Basically, here is the format of the connection manager code:
var transaction =YAHOO.util.Connect.asyncRequest(method, uri, callback, postData);
So, if we wanted to send a $_POST array to php with the variables web and space both equal to 1, we would use this code:
var transaction =YAHOO.util.Connect.asyncRequest(‘POST’, ‘server.php’, ‘web=1&space=1’);
As you can see, our code that parses this information is called server.php. What you want to do here is process any information you can, and then return something useful to the YUI library to display. The easiest way to do that is with an array and using the print_r. Remember: don’t do any actual visual work here, just return the stuff you want YUI to display for you. If you send an array, just use the Javascript function eval with the object o.responsetext like so:
var data=eval(o.responsetext);
There you go! For more information on the connection manager, please visit YUI’s documentation at:
http://developer.yahoo.com/yui/connection/
Popularity: 8% [?]
Links you may find interesting -
Contact
About
Privacy