Friday, October 27th, 2006
Projax: PHP Generators for Prototype and Script.aculo.us
Projax is a port of the Rails helpers that wrap the JavaScript required for Prototype and Script.aculo.us code from Ruby, to PHP classes.
Getting Started
The User Guide details the available functions:
JavaScript Helpers
- button_to_function($name,$function=null)
- link_to_function($name,$function,$html_options=null)
- tag($content)
- escape($javascript)
Prototype Helpers
- evaluate_remote_response()
- form_remote_tag($options)
- link_to_remote($name,$function,$html_options=null)
- observe_field($field_id,$options =null)
- observe_form($form,$options=null)
- periodically_call_remote($options=null)
- remote_function($options)
- submit_to_remote($name,$value,$options=null)
- dump($javascript)
- ID($id,$extend=null)
- alert($message)
- assign($variable,$value)
- ...
Script.aculo.us Helpers
- dragable_element($element_id,$options=null)
- drop_receiving_element($element_id,$options=null)
- sortable_element($element_id,$options=null)
- visual_effect($name,$element_id=false,$js_options=null)
- auto_complete_field($field_id,$options=null)
- in_place_editor($field_id,$options=null)
Some of these look a tad overkill? :)












The in-place editor has a problem. If you delete the contents and save, then try to edit that field again to enter some data its gone.
Its not a bug , you can spcify extra options to take care of this , for options please check out
http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
Hi Vikas,
Great work! anyway.. was the demo build together with codeigniter framework? i’ve noticed because the getting started guide is similar to codeigniter…
cheers c”,)
We’ve been working hard enough to keep the MVC structure clear so that they are easily maintain. Javascript is for the client side, and php is for the server side. Mixing those two into one is just not a good idea to me. one of reason I never got too excited about the Ruby’s prototype support is because of the nasty mixture of two different codes. It makes it harder to maintain and debug. I can’t believe now is the PHP’s turn.
@ r00t - Projax intial release was for CI , so the manual looks like CI’s.
@ Simon Jia - Yep u are right , for CodeIgniter ( a MVC framework ) I did generate the JS in the controller which was passed to the view for display, but doin so meant passing a lot of extra variables, So i found it best to include it in the view ( since it generates JS anyhow ).
[...] Projax: PHP Generators for Prototype and Script.aculo.us Explication et exemple de Projax sur le site Ajaxian (tags: ajax billet php web2.0 programming tips javascript generator) [...]
November 7 Linkdump
Royale Noir is the best-looking Windows XP theme I’ve seen. If you know enough about Windows to install it, you…
[...] Ajaxian » Projax: PHP Generators for Prototype and Script.aculo.us Ð”Ð»Ñ Ð»ÑŽÐ±Ð¸Ñ‚ÐµÐ»ÐµÐ¹ Ñделать что-то на AJAX - генераторы Ð´Ð»Ñ Prototype и Script.aculo.us на PHP (tags: php prototype scriptaculous ajax javascript вебдев программирование) [...]
$projax->sortabe_element does not call the url for updating… bug?
Thanks.Good article
Interesting Article. MMMM php! Armenian Genocide April 24th 1915.