Recommend this page to a friend! |
PHP Classes blog | > | What is Microsoft up ... | > | All threads | > | PHP - COMET | > | (Un) Subscribe thread alerts |
|
Felipe Nascimento de Moura - 2008-12-18 17:35:41
Hi, I've worked on a little library in JavaScript and PHP which provides a chance to make a fast and easy link between PHP server and the client side.
If you want, you can see it working on youtube, here: The programmer can implement it with one line of JavaScript code, but it uses, of course, some PHP elements that interact with this Js code. I don't know how is the comet development for PHP, so, if you could tell me what do you think about this, I'd be glad. I'm always working on make PHP better, bigger and famous, and I also would like to help more the comunit. I'm not famous or something like that, but I'm extremelly crative and inovator. I got interested in this fact of MS being helping PHP Comunit...let's see what happens then. Great post. Cheers... Hi, I've worked on a little library in JavaScript and PHP which provides a chance to make a fast and easy link between PHP server and the client side. If you want, you can see it working on youtube, here: The programmer can implement it with one line of JavaScript code, but it uses, of course, some PHP elements that interact with this Js code. I don't know how is the comet development for PHP, so, if you could tell me what do you think about this, I'd be glad. I'm always working on make PHP better, bigger and famous, and I also would like to help more the community. I'm not famous or something like that, but I'm extremely creative and innovator. I got interested in this fact of MS being helping PHP Community...let's see what happens then. Great post. Cheers... -- Felipe N. de Moura Desenvolvimento Web thewebmind.blogspot.com felipenmoura@gmail.com --------------------------------- Fazendo da web um lugar melhor pra se viver. Making the web a better place to live
Manuel Lemos - 2008-12-18 22:43:54 - In reply to message 1 from Felipe Nascimento de Moura
PHP COMET support is implemented by the AJAX plug-in that comes with this forms generation and validation class mentioned in the article pointed by this Microsoft article.
phpclasses.org/formsgeneration Here you can watch a tutorial video explaining how it works: phpclasses.org/browse/video/1/packa ...Here you see a live example that shows progress of activity running on the server after the form is submitted. meta-language.net/forms-examples.ht ...It would be relatively easy to provide an example of monitoring the files in a directory using this AJAX COMET plugin that comes with this class.
Felipe Nascimento de Moura - 2008-12-18 23:54:18 - In reply to message 2 from Manuel Lemos
Well.
Interesting...but...that is based on hiddenFrame techniques, right? Ajax, by definition, has one XMLHTTPRequest, cuz the X means XML. And as definition, an iFrame is not asynchronous, cuz it stops and keeps the connection opened...your parent frame isn't stoped loading, but the frame that did the requisition is, so, it's not asyncronous. it is not an original Ajax technique, is it? I'm sorry if I'm mistaken. Of course, the result is almost the same, like magic, but, ilusionism, I meant. This plug in is very interesting, but I didn't like the idea of creating even the input elements with this php class like obj->addInput(...) too much things!! Sounds like Java, trying to use a bazooka to kill a little fly. well, my library is very different(maybe not with all those functionalities), you do it with one JS line. You create some function to be called any time that the output of your listened php files changes. then: obj= new elo(); // elo is the js object to link to the server obj.addListener(func, 'file.php'); Ok, any moment that your file 'file.php' changes the output, your function 'func' will be called receiving the file output content (the output could be the HTML from some DB connection, or, like I used in my video example, after reading the files from some dir in the operational system). Its context is different, and the goals are different too. I'm just explaining this differences and trying to show you why I developed that. About Microsoft, well, if their intentions help php for awhile, it's ok ... for awhile. Cheers.
Manuel Lemos - 2008-12-19 20:01:24 - In reply to message 3 from Felipe Nascimento de Moura
There are a few misunderstandings.
Asynchronous means that the AJAX request that is sent to the server does not prevent the user to continue to view and interact with the current page. Whether it uses XML or not is not relevant either. Most people that use XMLHTTPRequest do not use it to send or retrieve XML requests. What matters is that most people associate AJAX with the ability to being able to communicate with the server without reloading the current page. The use of hidden IFrame is much more powerful than using XMLHttpRequest objects. Not only you can upload files to the server using hidden IFrames (which is impossible with XMLHttpRequest), but you also are able to receive multiple responses from the server about asynchronous events. With XMLHttpRequest usually you only get one response from the server, so you need to keep polling the server regularly to check if there were any updates. That is slow and wastes bandwidth. Unlike you mentioned, with the hidden IFrame technique the server only leaves the connection opened if the server wants to. A good use of that is to follow the progress of a server task that takes a while to complete, like for instance the progress of a file upload. Here is a live example of file upload progress bar using this plug-in: meta-language.net/forms-examples.ht ...This forms class was created with the intention to generate HTML and Javascript without people having to learn Javascript to do they stuff. The AJAX plug-in was created to easily submit forms to the server without reloading the page, all without having to write Javascript. There are other plug-ins that use the AJAX form submit plug-in, like the file upload progress plug-in that I mentioned, the linked select inputs plug-in and the autocomplete plug-in. The AJAX plug-in was also use to implement fast pagination of the search results using the own site search only available to premium subscribers: phpclasses.org/premium/videos/site- ...It was also used in the site login page: phpclasses.org/login.html It is relatively simple to learn the forms class and its plug-ins, but like any new library you need to learn something to start using it. As for your library, I do not know it to understand if there are any situations on which using it would be more convenient. Anyway, you can always write a plug-in for using it with the forms class. Just let me know if you are interested in that and would like help in creating a new plug-in. |
info at phpclasses dot org
.