-
Notifications
You must be signed in to change notification settings - Fork 0
Projex
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 Projex Website 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:
include("JavaScript.php");
include("Prototype.php");
include("Scriptaculous.php");
Then create a test page in your CI/controller/test.php
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'] .= '<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />';
$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>';
}