Skip to content
World Wide Web Server edited this page Jul 4, 2012 · 5 revisions

Category:Libraries Category:Libraries::AJAX

Here you will find integration of Projax in to CodeIgniter

Projax stands for Prototype and Ajax. Projax is a set of Open Source PHP Classes which help you build more interactive Web Application / websites with minimal effort. Projax help you build better applications by providing easy to use API which siplifies tasks involving Ajax , Effects , DOM etc. At its core Projax is a RoR javascript helpers port for PHP. For Ajax and DOM Projax uses Prototype on client side , and for Effects like drag and drop etc it uses Script.aculo.us.

Download the code from the [url=http://www.ngcoders.com/projax/]Projex Website[/url] then copy the files from the projax/classes folder to your CI/libraries folder then also copy the projax.php file to your CI/libraries folder

open your CI/libraries/projax.php file and change the includes to look like this: [code] include("JavaScript.php"); include("Prototype.php"); include("Scriptaculous.php"); [/code]

The create a test page in your CI/controler/test.php [code] function ajax() { $this->tpl['tpljs'][] = 'prototype'; $this->tpl['tpljs'][] = 'scriptaculous'; $this->load->library('Projax'); $this->tpl['body'] = 'Please enter your year of birth : ' . $this->projax->text_field_with_auto_complete('dob',null,array('url'=> site_url('test/ajaxsearch'))); $this->tpl['body'] .= '

















'; $this->load->view('layout/blank', $this->tpl); }

function ajaxsearch()
{
    $ret_val = '';
    for($i=1900;$i<2006;$i++)$ret_val.=(strstr($i,$_POST['dob']))?'<li>'.$i.'</li>':'';
    echo '<ul>'.$ret_val.'</ul>';
}

[/code]

[url=http://codeigniter.com/forums/viewthread/46307/]Forum Link[/url]

Clone this wiki locally