A very basic but powerful implementation of Ajax Framework that complements Codeigniter.
Download here:
Download From Google CodeCjax Framework separates your ajax controllers from your regular controllers. While your normal controllers reside in application/controllers, your ajax controllers will reside in application/response.
Install
Download and unzip the Ajax Framework package, then just overwrite everything from the zip into your CodeIgniter base installation (will not replace any of your files)Test
just go to:http://yoursite.com/ajax.php?controller=test&function=test
(replace http://yoursite.com with the base directory where your CodeIgniter installation resides)
To this point you are done, successfully installing and using Cjax, if the test above prints “Ajax View..”. You can find this text inside file application/views/test.php, and its controller in application/response/test.php.
Friendly URLS
Full support for friendly URLS.Friendly URLS are supported, but not required to use Cjax.
You may access your controllers in any of the following ways; these examples make use of controller file application/response/test.php.
//ajax.php?controller=$controller&function;=$functionajax.php?controller=test&function=test//ajax.php?$controller/$functionajax.php?test/test//ajax/$controller/$function
#This one requires mod_rewriteajax/test/test
Creating Controllers
Creating controllers works the same way as your regular controllers, except the class name of ajax controller start with the keyword “controller_”. For example, if you want to create a controller named test, then your class name would be “controller_test”.Example
application/response/test.php
class controller_test extends CI_Controller {
function test()
{
}
}
0 komentar:
Posting Komentar