|
Cookbook /
DataPlatesSummary: Automatically generate templates for displaying, editing, and searching database queries.
Version: 0.3
Status: beta
Maintainer: Ben Stallings
Questions answered by this recipeHow can I quickly and painlessly create a PmWiki front-end for an existing database table or query, without having to write forms and pagelist templates by hand? DescriptionDataPlates automatically creates Fox or ZAP forms and pagelist templates for the groups of pages configured in DataQuery, which can then be customized and saved as wiki pages. By default it uses the structure described in EditDataPages so that records are displayed as wiki pages and can be edited by clicking the Edit link, but this behavior can be changed. The forms automatically employ client-side (JavaScript) validation to encourage entry of valid data into your database. Full documentation and demonstration of all the features of this recipe are available at its demo site, http://workscited.net/dataplates .
To install it, include the file in your config.php. Any configuration of the $DQglobals variable should come before inclusion of the PHP files. If using ZAP install both ZAP files. Here is an example config.php, showing the configuration and inclusion of all three recipes. $Databases['demo'] = array( 'driver' => 'mysql', 'hostname' => 'db.workscited.net', 'database' => 'demo', 'username' => 'workscited', 'password' => '********'); $DQglobals['scriptfile'] = "$PubDirUrl/dFilter.js"; include "$FarmD/cookbook/dataquery.php"; include "$FarmD/cookbook/dataplates.php"; include "$FarmD/cookbook/zap.php"; include "$FarmD/cookbook/zaptoolbox.php"; Here is an example config entry which uses Fox and the latest dataplates2.phpΔ and dataquery2.phpΔ.
# add any Fox configuration variables here....
include_once("$FarmD/cookbook/fox/fox.php");
$Databases['demo'] = array(
'driver' => 'mysql',
'hostname' => 'db.workscited.net',
'database' => 'demo',
'username' => 'workscited',
'password' => '********');
$DQglobals['scriptfile'] = "$PubDirUrl/dFilter.js";
include "$FarmD/cookbook/dataquery2.php";
include "$FarmD/cookbook/dataplates2.php";
DataPlates attempts to use an external JavaScript for input masking. If you are running a testing server without a connection to the Internet, you will want to save a local copy of the JavaScript file from http://workscited.net/dFilter.js to your /pmwiki/pub/ directory and change the $DQglobals['scriptfile'] variable as shown above; otherwise your computer will attempt to access the Internet every time you load a page. If you do not want to use the JavaScript at all, simply set this variable to "" and it will not be used. NotesIf you are running on a slow server, you may wish to enable DataPlates only long enough to generate the forms and templates you wish to use, customize those pages and save your changes, and then disable DataPlates again before opening the new part of your wiki to the public. The main utility of DataPlates is in helping you create your database front-end. Once you have customized your templates, it is not necessary to leave DataPlates installed. Features that are working as of 2007-06-10:
Features that are not working yet
Known bugs
The most helpful thing beta testers can do at this point is to use DataPlates to create drafts of templates and forms, customize these pages to work the way you want, and send me the customized wiki code, so that I can tweak DataPlates to create the desired code automatically. Bug reports are also appreciated, though I can't promise to get to them right away! I am no longer available to work on this project for free, but I am accepting bounties. Contact me at Profiles.Ben Stallings. Release Notes
CommentsAs stated at the dataplates demo site it is mainly thought to get data into a database. If you want to use a numerical index as a first array in your database table (e.g.: ID|Titel|Text|Author), you can easily achieve this by using powertools.php and with the following wiki-link See AlsoContributors
User notes?: If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date * (-) Optional negative comment. Name, date These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |