|
<?php include('/big/dom/xphplens/www/php/phplens/phplens.inc.php'); session_start(); //---------------------------------------- // The following lines are for formatting // the page and not needed by phplens $gTitle = "Search Demo"; include('./header.php');
//---------------------------------------------------- // setup lens and render it with persistent connection $lens = PHPLensPConnect ( 'ex200', // id to uniquely identify this phplens setup "select * from products", 'mysql', // database server type, eg. pgsql, odbc, mssql, oci8 $gEX_server, // eg. localhost or ODBC DSN $gEX_userid, $gEX_password, $gEX_db); // optional, name of database to connect to if ($lens) { $lens->firstState = "FILTER"; $lens->filterLens = "ProductName;SupplierID;CategoryID"; $lens->nameLens = "ProductID^ID;SupplierID^Supplier;CategoryID^Category"; $lens->lookupLens = "SupplierID^select supplierid,companyname from suppliers;". "CategoryID^select categoryid,categoryname from categories"; // for category ID turn checkboxes on, 2 cols per row $lens->filterParams = 'CATEGORYID^^checkbox^2;'; //$lens->dynEdit = 0; // disable designer editing $lens->dynEdit = 2; //changed $lens->canEdit = false; // disable data editing $lens->colorNavBorder = 'indianred'; $lens->colorTitle = 'orange'; $lens->colorOdd = 'lightyellow'; $lens->colorEven = 'beige'; //----------------- // Generate HTML $lens->Render(); $lens->Close();
} ?> <h4>Notes</h4>
<p>To start with the search screen instead of the grid set $lens->firstState = "FILTER".</p> <p>We also join the SupplierID and CategoryID columns using <i>joinLens</i> so that instead of seeing numbers, we see meaningful descriptions. This works both when filtering and viewing the grid. </p> <p>We also configure the categories to show as checkboxes by setting <i>filterParams</i>. This <i>filterParams</i> setting was configured in dynamic edit mode, then generating the source code and copying the relevant line into the PHP file. Easy compared to generating it hand!</p> <?php include ('./footer.php'); ?>
|
|