Tuesday, November 21st, 2006

AjaxCore: PHP Ajax Framework

Category: JavaScript, Library, PHP

>They keep on coming folks. Mauro Niewolski has created AjaxCore which is “a multi-purpose PHP framework that ease the development of rich Ajax applications, by generating the appropriate JavaScript code. AjaxCore takes all the dirty work of JavaScript code generation and provides a solid foundation. The concept is to extend a Generic AjaxCore class and defining methods that handle the Ajax driven events and binding them to HTML objects. It uses Prototype’s JavaScript standard library for getting DOM (Document Object Model ) elements and handling asynchronous XMLHttpRequest One distinguish point to remark is that, by letting you Bind events on HTML objects that will execute server side code,it let’s you solve any specific requirement without the hassle of coding particular JavaScript code to handle specific events.”

Usage

  • bind ( does a bind between a html object and a php function, when a JavaScript event is triggered )
  • bindTimer ( does a bind between a html object and a php function, when a JavaScript event is triggered and timer expires)
  • bindPeriodicalTimer ( does a bind between a html object and a php function, when a JavaScript event is triggered and keeps repeating each time timer expires).

The key is, just make a class that extends from “AjaxCore” and define a function to handle Ajax requests, and then bind an HTML object to that function upon a JavaScript event ( like onClick and so on..), you can even assign several JavaScript events to the same PHP function with no hassle. Also, If you have to send some HTML elements values to the PHP function, it’s as simple as type the ID of the html element and then retrive it on php with $this->request['elementName'] method, you can even send static values with no HTML ID by appending a (‘ _ ‘) prefix to the element, as _XXX=YYY , whether XXX represents variable name, and YYY value.

Mauro has a combo example that has code such as:

  1. echo $ajax->bind("genre","onchange","onGenreChange","genre"); /* Bind genre combo, to PHP function onGenreChange upon JavaScript's onchange event is triggered  */

Related Content:

Posted by Dion Almaer at 7:58 am
7 Comments

+++--
3.9 rating from 383 votes

7 Comments »

Comments feed TrackBack URI

It is amazing though that projects like fusebox.org are not yet extended to standardize binding of server-side actions to client-side UI elements…

Is there any such work in the community?

Comment by abomuhammed — November 21, 2006

There is framework, what knows the same thing (attach and deattach events from the PHP side). The name is Protojax ( http://sourceforge.net/protojax/ ).
And it has script.aculo.us plugin, and many more service for handle JS libraries from the PHP side. But, it has no JS generating mode. I do not like that. :)
Demo page: http://www.theba.hu/protojax/example/index.html

Comment by Amon — November 21, 2006

PradoSoft.com

Comment by Mario — November 21, 2006

Fusebox is built to be as un-connected to the application code as possible, that’s why it supports OO but doesn’t require it or force it, and why it has support for role-based permissions but doesn’t actually enforce them. It’s left up to the developer community to build the tools that actually “do” something with the framework. I’ve been building Ajax’ed Fusebox applications for a while now, and have found that freedom to be just what the doctor ordered. I start the app out with ‘analog’ functions, and use Hijax on forms or links to enable the rich functions. Then in my action-only fuseactions I test to see whether the request is analog or javascript, and either <relocate/> back to the view or <include/> a callback script file to complete the Ajax call.

Comment by Mike Ritchie — November 21, 2006

Ajaxcore : un framework PHP pour gérer l’AJAX plus facilement

Un article sur ajaxian nous informe sur la création d’un nouveau Framework PHP basé sur Prototype, AjaxCore, permettant de gérer toute la programmation AJAX à partir de PHP de manière rapide et facile. Je n’ai pas encore fait de test avec AjaxCore

Trackback by Entre zero et un — November 23, 2006

I am impressed. its such more useful for developer.
If someone post some html form basic validation thru Ajax.

Comment by Chintan — November 25, 2006

Ajax mit PHP

Einzelne Bereiche von Webseiten dynamisch zu aktualisieren ist eine tolle Sache. Heutzutage fällt für diesen Zweck sofort das Buzzword Ajax. Wobei es völlig egal ist ob man die Daten nun in XML (AjaX), JSON oder sonst wie verpackt. Auch ich möchte …

Trackback by .: blogging augusto :. — November 28, 2006

Leave a comment

You must be logged in to post a comment.