We know well that some things are better done on the server-side while other things are better done in the browser. When it comes to integrating JavaScript with PHP, most PHP frameworks offer no help at all.
Agile Toolkit has a unique Native integration. The principle is incredible simple yet amazingly powerful. You define JavaScript behaviour in a plain PHP language.
Below are just some examples of how short PHP code can produce a fully-functional AJAX applications. They demonstrate independence of widgets, and are both implemented as a short block of PHP code, no extra JavaScript or CSS required.
$f=$p->add('Form',null,null,array('form_empty')); $f->addField('line','a','') ->set(2)->setProperty('size',4) ->template->trySet('after_field','+'); $f->addField('line','b','') ->set(3)->setProperty('size',4) ->add('Icon',null,'after_field') ->set('arrows-right')->setStyle('margin-left','9px') ->setAttr('title','Will calculate result on the server through AJAX request') ->js('click',$f->js()->submit()); $sum=$f->addField('line','sum','') ->setProperty('size',6); if($f->isSubmitted()){ // If security check above fails, this // code can't be reached no matter what $sum->js() ->val($f->get('a')+$f->get('b')) ->execute(); } /?>Agile Toolkit hides a lot of complexity a typical use of JavaScript on AJAX site would encounter. Loading indication, dependencies, 3rd party jQuery plugin integration, load-on-demand, JavaScript escaping and encoding, JSON as well as many other small tasks are routinely performed by Agile Toolkit.
$page->js() ->_load("highcharts/highcharts") ->_load("ui.highcharts"); $page->add("View_HtmlElement") ->js(true) ->univ() ->highchart(array( 'chart'=>array('width'=>480,'height'=>300), 'title'=>array('text'=>'Why Will Love You Agile Toolkit?'), 'series'=>array(array('type'=>'pie', 'data'=>array( array('Simple to Learn',40), array('Looks Awesome',30), array('Enterprise Features',20) ) )))); /?>