Field name
When the MySQL column name is not appropriate for display as the title of the
column in the displayed table, alternate text can be specified. To display the
word "Subject" instead of the name "Topic" for the example column from previous
chapter, add the following option to the script:
Example 4-2. Field name examples
$opts['fdd']['topic']['name'] = 'Subject';
When creating MySQL tables for use with phpMyEdit, consider using the underscore
character in certain field names. For example, a MySQL column named
"last_name" will be displayed as "Last name" in tables created using phpMyEdit
(underscore characters are replaced with a space).
Guidance / Help
Sometimes a short title can't be explicit enough, so it is neccessary to
provide the user a large description on a given field when he is manipulating
with field data. For this purpose was
$opts['fdd']['col_name']['help']
option created. Content of this
option will appear in the third column of record display pages (Add, View, Change,
Copy and Delete modes).
This option is optional. If there is no ['help']
option for all
columns, the third "help" column will be omitted.
Example 4-3. Field guidance
$opts['fdd']['topic']['help'] = 'Enter topic of article here.';
Because the field content is not escaped, you can add any HTML markups there,
for example hyperlink, JavaScript opening popup window, etc.
Example 4-4. Field guidance hyperlink
$opts['fdd']['topic']['help'] = '<a href="help.php?about=topic" target="_blank">?</a>';
Selection boxes
Specify field input type as text box, numeric comparison text box, drop-down
selection, or multiple selection. The same input type will be used also for
table filtering.
Example 4-5. Filter selections
$opts['fdd']['col_name']['select'] = 'T'; // text box
$opts['fdd']['col_name']['select'] = 'N'; // numeric
$opts['fdd']['col_name']['select'] = 'D'; // drop down
$opts['fdd']['col_name']['select'] = 'M'; // multiple selection
$opts['fdd']['col_name']['select'] = 'O'; // radio buttons
$opts['fdd']['col_name']['select'] = 'C'; // checkboxes
Display options
An optional parameter to control whether a field is displayed in the add,
change, copy, delete, view, list, or filter views.
A | -- add |
C | -- change |
P | -- copy |
V | -- view |
D | -- delete |
L | -- table list |
F | -- table filter |
Example 4-6. Field display options
$opts['fdd']['col_name']['options'] = 'LF'; // shows only in table list/filter
Input settings
There are also additional column-specific options. These apply to certain
views or modes (add, change, delete, list). In the previous versions of phpMyEdit
these flags was part of ['options']
option. In the current
5.7.1 version, the backward compatibility (BC) is preserved. However this
will be removed in the future. Thus specify these flags as a part of
['input']
options. Some other flags may be added into this
option as well.
R | -- indicates a field is read only |
W | -- indicates a field is a password field |
H | -- indicates a field is to be hidden and marked as hidden |
Example 4-7. Other display options
$opts['fdd']['col_name']['input'] = 'H'; // hidden field
$opts['fdd']['col_name']['input'] = 'P'; // password field
$opts['fdd']['col_name']['input'] = 'R'; // read-only field
CSS customization
Per field, you can define field CSS class names postfix. This is especially
useful in order to highlight one column in a table.
Example 4-8. Field CSS customization
$opts['fdd']['col_name']['css'] = array(
'postfix' => 'ColName'
);
More information about CSS handling can be found in the CSS classes policy section.