Hello,
I just finished a quick attempt to bridge SmartGWT 2.5 with php. You can find the library here:
http://scalingexcellence.co.uk/sgrjp...on-php-library
This library provides some helpers that should make integrating with php as easy as essentially 4 lines of code (see the example below). It supports CRUD, server side filtering and sorting. It intentionally doesn't provide authentication or other application specific aspects in order to be as generic and reusable as possible.
Right know I provide an example implementation with MySQL database back-end. It should be quite easy to make it support MongoDB, CouchDB and ORM's and semi-trivial to support other SQL based languages.
Use (MySQL example):
This doesn't intent to become as complete as the Java Server-side solution SmartGWT provides, but it can still help anyone who has to interface SmartGWT with php and doesn't want to reinvent the wheel.
Please tell me your thoughts, if you find it useful etc.
I just finished a quick attempt to bridge SmartGWT 2.5 with php. You can find the library here:
http://scalingexcellence.co.uk/sgrjp...on-php-library
This library provides some helpers that should make integrating with php as easy as essentially 4 lines of code (see the example below). It supports CRUD, server side filtering and sorting. It intentionally doesn't provide authentication or other application specific aspects in order to be as generic and reusable as possible.
Right know I provide an example implementation with MySQL database back-end. It should be quite easy to make it support MongoDB, CouchDB and ORM's and semi-trivial to support other SQL based languages.
Use (MySQL example):
Code:
require_once(dirname(__FILE__).'/lib/sgrjp.php'); require_once(dirname(__FILE__).'/lib/mysql.example.php'); $ob = new sgrjp(); try { //Open a connection if (!mysql_connect('localhost', '...', '...')) { throw new Exception("Can't open MySQL connection. Wrong username/password?"); } //Configure and select db mysql_query("SET CHARACTER SET utf8"); mysql_select_db("sgrjp"); $pks = array("ItemsDs"=>array("SKU"), "supplyCategoryDS"=>array("categoryName")); //Retrieve the request object $req = $ob->decodePostAndGet(); //Convert the request to an SQL query using our example MySQL parser and run list($ds, $total) = sqlparser::run($req, $req->ds, $pks[$req->ds], false); mysql_close(); //Return the results as a properly formatted JSON object $ob->returnResult($ds, $req->startRow, $total);
Please tell me your thoughts, if you find it useful etc.
Comment