Saturday, July 9, 2011

php script that generates a EXT JS grid for each table in a mysql database

I put together a script that generates a EXT JS grid for each table within a mysql database. A html, js and php file are created for each table.

It is barebones, but feel free to use as your own or push changes to github.

https://github.com/jonaldomo/php-ext_js-grid_creator/blob/master/php-ext_js-grid-creator.php

Instructions to use:
1. Assumes a web server is setup with PHP installed with network access to the mysql database.
2. Download and extract ExtJS 4 library from www.sencha.com
3. Download php-ext_js-grid-creator.php to web root on the webserver.
4. Edit lines 16-19 in the script with the mysql host, username, password and schema.
5. Edit lines 25-27 with the directory where ExtJS is housed in relation to the script. 26 is the SDK JS file and line 27 is the location of the CSS file.
6. Open a web browser and load the script in the address bar. Example: http://localhost/php-ext_js-grid-creator.php and load. Within seconds html, php and js will be generated. The grid will be viewable from the .html files.