Table of Contents

## Dynamic Editing with Global phpLens Settings

The Dynamic editor allows you to modify global phpLens settings such as the colors and the SQL statement to use. From the top left of the phpLens grid, click the red Edit phpLens Settings icon to run the Dynamic Editor. This will bring you to the page shown below. At the top of the page is the menu bar which allows you to move to different dynamic editing screens.

Just below the menu is the global color settings. On the right is Select Color Style where you can choose from the preset Color Styles. You can also define your own color styles by adding new array entries to the Javascript array PHPLENS_styles in phplens/img/phplens-js.styles.js.

Below the color settings (not visible in above picture) you can set whether the records can be edited, deleted, or created, define the primary key and table to update, sort and date settings, and whether debugging information is turned on. Context sensitive help is available for most options.

New to phpLens 1.2 is that the SQL and Key Table fields support PHP global variables if the first character in the field is =. For example, suppose you have multiple tables that hold postcodes for specific countries, eg: usacodes, japancodes, ukcodes, malaysiacodes. You can store the country in a global variable $COUNTRY and set the sql property to:

    =SELECT * FROM {$COUNTRY}CODES

In phpLens 1.3 we had the new Details Editor which allowed you to edit a record in the details area next to the main grid. This is controlled by the Child Editor in Detail Grid popup list..

New to phpLens 2.0 is the Edit Multiple Records checkbox that allows you to enter edit multiple records in the grid. Also when we want the phpLens table to expand to fit the whole screen, we now have the new Table Width 100% checkbox. This modifies the layoutTableHeader, gridTableHeader and detailTableHeader properties dynamicly.

New to phpLens 2.2 is the Export as Excel or CSV feature. You click on an icon and the file is generated for download to the client browser. See exportLens and exportOptions.

### Cascading Style-Sheets

Since version 2.5, PhpLens comes with a default style sheet in phplens/img/phplens.css. You can use your own style-sheet by setting the css property:

$lens->css = '/css/myphplens.css';

Then you can define styles for different parts of phpLens. For example, to configure the background of field titles, you could define in myphplens.css:

.lens-title {background:lightyellow}

and in your source code:

$lens->colorTitle = 'lightyellow class=lens-title'

For non-CSS compliant browsers, the field title will be lightyellow, which for CSS compliant ones, the lens-title class will be used. Note that the default non-CSS color must be defined first, before the CSS class selector is defined.

Partial List of Properties that Support CSS after the color is specified
colorNavBorder
colorNav
colorOdd
colorEven
colorSelect
colorRecNo
colorGroup
colorSubFooter
colorFooter
detailLeftColor
detailRightColor
colorBackground

Tips

You can configure the following things when creating records:

How Do I... | Solution | Properties modified
Create scrolling links like google? | Enter the number of Scroll Links in global settings. Or set $lens->scrollLinks to the number of scroll links you want to see. An odd number is recommended. | scrollLinks
How do i debug phpLens | You can turn on debugging by setting $lens->debug = 1 (or 2 for more info), or selecting Debug from the global settings. This will output the SQL generated, any error messages, the current internal state of phpLens, and other useful information, | debug
Allow editing in the detail grid | Set the Child Editor in Detail Grid setting. | childLens
How do I enable editing? | In global settings, first define the Table data is saved to, and the Primary Key of Table. Then click on Save Settings. The next time you open global settings, you will be able to enable editing, creating new records and deleting. | keyCol, keyTable, canEdit, canDelete, canNew
How do i start phpLens in search mode | Set Start phpLens to "Search Form showing Records", or if you want to only show the search form when no search is running, select "Search Form". | firstState
Perform editing within the grid | Check the Edit Multiple Records checkbox, or set $lens->editMultiple = true. | editMultiple