Home | ExtJs Website | ExtJs Official Examples | ExtJs Forum | Other ExtJs Links

Ext AJAX Php Class

OO Update Class

This class is very simple, so the docs are quite succint :)

Basically we wrap a small subset of ExtJS inside a php class which allows you to update parts of your page in an AJAX fashion without needing to learn any javascript. Whilst this is useful on small scale applications - it is probably not up to scratch for enterprise useage.

Click here to download the zip file

Whats in the zip?

Included in the zip are the files required to make this work:

How do you use it?

Invoke an instance of the class (require_once first) and use that across the page to access the class methods.

In the head area of your html page call the 2 javascript scripts

Almost done!

Now when you need to have a section of your page updated, call the link generation method with some parameters and the class will make the link correctly when you run the page.

Lets break that down a little:

Now create a server side php file

The server side file simply captures the request from javascript and processes it, it then returns JSON encoded text along with a status message (Success / Fail) which advises the javascript what to do.

You can do anything you like as long as you maintain a couple of things.

An example of the above link would require code similar as follows:

Optional parameters which can be set:

There are a couple of optional parameters which can be used to tweak the way the class operates for your individual useage.

setPHPPath = this sets the path to your server side file from the web root
default: /classes/oo_update/php/updateJS.php
example: $update->setPHPPath('/your/path/here/myserverfile.php')

setJSPath = this sets the path to the javascript file from the web root
default: /classes/oo_update/js/ooUpdateJS.js
example: $update->setJSPath('/js/ooUpdateJS.js')

setEXTPath = this sets the path to the ExtJS file from the web root (you may already use one)
default: /classes/oo_update/js/mini-ext.js
example: $update->setEXTPath('/ext-2.0/ext-all.js')

 

ooUpdateJS is © Owen Lees 2008
(Apart from the Ext Library which most certaintly isnt!)

ExtJS can be found here...

 

We used...


Try it out!

OO Update demo page.

This page demonstrates the AJAX update using the code samples above.

This is a link with the onClick part generated by the class....Click Me!

I am the div who's content will be updated.

This is another link with the onClick part generated by the class, this time we insert some latinesque from the server side....Click me too!

We didnt use any arguments this time as the server script doesnt require any.

 

ooUpdateJS is © Owen Lees 2008
(Apart from the Ext Library which most certaintly isnt!)

ExtJS can be found here...


The Javascript Code

The PHP Code