phpLens manual: Grid Builder
Table of Contents
The Grid Builder allows you to quickly create phpLens objects and Generate
PHP Source Code for any table in a list of available databases. Select a database,
then a table and the phpLens object for that table is automatically created for
you. In the example below, the Region table is being selected and the phpLens
representation of that table will be created.
After you complete configuring phpLens the way you want it, click on
Generate PHP Code. Save the generated code in a .php file and you are in action!
Configuring the Grid Builder
To configure the phpLens Grid Builder, you need to
- Password protect your Grid Builder directory (you might need to talk to your Webmaster to do this).
- Set the PHPLENS_DIR constant to the location of the phpLens directory.
- Define the databases you want to connect to in PHPLENS_DIR.'/config/phplens.config.inc.php'.
- Password protect this directory to ensure only authorised staff have access to your database.
In the latest version of phpLens, PHPLENS_DIR is autoconfigured for you.
If for some obscure reason the Grid Builder is not working,
you will have to set it in init.php. It's the line that's
commented out around lines 5-7.
The Grid Builder can autoconfigure itself as long as it is
placed as a sub-directory of the phplens folder.
Scroll to the bottom of the file PHPLENS_DIR/config/phplens.config.inc.php.
Search for the following array variable in the file:
array( //driver, server, userid, pwd, database
'northwind' => array('access','nwind','','',''),
'phplens data' => array('mysql','phplens','root','password','phplens')
This lists out all the databases that the Grid Builder can access. The key is the name to display (eg. northwind),
and each array element consists of the following
array($driver, $server, $userid, $password, $database).
Legal database drivers include
'mysql', 'postgres', 'postgres7', 'mssql', 'sybase', 'oracle', 'oci8',
'access', 'vfp', 'odbc', 'ibase'. Refer to ADODB readme.htm file for more information on database drivers.
This allows you to enter SQL and see the results coming back. We found it useful
for debugging SQL and have included it in the phpLens package as an freebie.
It does not interact with phpLens at all.
List Tables provides an easy way to view the tables available in a database. Clicking
on a table will bring return the table records and some information about each column such
as the type and maximum length.
This documentation system is maintained using phpLens