« Tacos, Tapestry component repository and AJAX rendering framework | Main | "Building Responsive Web Applications with AJAX and PHP" Book »

CBL Partial Updater, Simple AJAX library for PHP

CBL Partial Updater is an AJAX library for PHP. Unlike other libraries, all operations are controlled by the server side. Using the library, it is very easy to add AJAX features to existing PHP applications. Just add a few lines to your PHP and HTML, and your web application turns into an AJAX app.

cbl.png

The usage of CBL Partial Updater is simple as including the prototype and CBL libraries, then by setting the onsubmit event for the form in the client side :

<script language="JavaScript" src="prototype.js"></script>
<script language="JavaScript" src="partialupdater.js"></script>
...
<span id='count'><% = $num %>
...
<form onSubmit="CBL_PartialUpdater.update('index.php', this); return false">
...
</form>

Then in the server side depending on using Smarty or no, you can simply use for smarty

require_once 'partialupdater.class.php';
...
CBL_PartialUpdater::display($smarty, 'index.tpl', 'count');

and for normal pages :

require_once 'partialupdater.class.php';
...
ob_start();
...
your HTML output code
...
CBL_PartialUpdater::ob_end('count');

You can find also on the website howto add support for live search and displaying the progress indicator. CBL Partial Updater is written in PHP and require the HTML Parser for PHP4 and the prototype library. Demo is available in the website. Released under LGPL license.

Bookmark this article at these sites
Post a comment





(Email will remain hidden)





Please enter the security code you see here




Related entries
Email to a friend
Email this article to:


Your email address:


Message (optional):