Platon Technologies
neprihlásený Prihlásiť Registrácia
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 23. január 2017
O nás
Otvorený softvér
Index  »  Projekty  »  phpMyEdit  »  Dokumentácia  »  HTML  »  Output control

4.6. Output control

Cell attributes

For setting simple HTML attributes of displayed field cells, there is a ['colattrs'] option provided.

For example the alignment of the text inside a column can be controlled using the usual HTML align attribute of the cell tag. The text in the column will be placed in the center. Useful if you have numbers in a column and the title of the column is long.

Example 4-21. Cell attribute example

$opts['fdd']['col_name']['colattrs'] = 'align="center"';

Please note, that recommended and probably also better approach for displayed columns design control is to use CSS classes policy. Particulary point at CSS customization for more information how to customize selected field appearance.

Field size

A size of input field can be defined. Note this does affect also table filtering page. If you want different value for this type of page, use Options variability feature.

Example 4-22. Input field size

$opts['fdd']['col_name']['size']   = '10';
$opts['fdd']['col_name']['size|F'] = '5'; // only 5 for filter

Maximum field length

Maximum length of input boxes displayed for Add / Change record mode may be set.

Example 4-23. Field sizes

$opts['fdd']['col_name']['maxlen'] = '8';
$opts['fdd']['col_name']['maxlen'] = '24'; 

Textarea sizes

If the above setting does not work for you, you are probably attempting to change textarea size. It is also possible to specify the size of a textarea used to give multi-line input. Try something like:

Example 4-24. Textarea field height & width

$opts['fdd']['col_name']['textarea']['rows'] = 1;
$opts['fdd']['col_name']['textarea']['cols'] = 40;

Character length limit

If a table contains a number of text columns which each contain quite a bit of text, the table will likely scroll off the screen. This can be prevented by displaying only a portion of the content from a particular column.

For example, to display only the first 30 characters from a column named 'explanation', add the following:

Example 4-25. Character length limit

$opts['fdd']['explanation']['trimlen'] = 30; 

You may find it useful to limit the number of characters displayed for one or more columns. This option is approximately equivalent to the following PHP statement:

if (strlen($value) > $trimlen) {
	echo substr($value, 0, $trimlen - 3) . '...';


The 'nowrap' option is essentially equivalent to the HTML markup <td nowrap>.

Example 4-26. Wrapping

$opts['fdd']['col_name']['nowrap'] = true;
$opts['fdd']['col_name']['nowrap'] = false;

Print mask

A string that is used by sprintf() to format field output. For more information about this function usage, please refer to its manual page in PHP documentation.

Example 4-27. Print mask field definition

$opts['fdd']['col_name']['mask'] = '%%';     // a literal percent character
$opts['fdd']['col_name']['mask'] = '%01.2f'; // currency or floating-point number
$opts['fdd']['col_name']['mask'] = '%.10s';  // trim string to 10 characters

Date masks

Date mask is string that is used to format date and/or time fields using PHP's function call. You can use ['datemask'] option to format date and time using date() function or you can use ['strftimemask'] option to format date and time using strftime() function. See function's manual pages for valid formatting characters.

These date and time formatting functions are applied only if selected value from database has non-zero length and is a valid date. This prevents empty strings, NULL fields and invalid dates from being displayed as date of 1st January 1970.

Example 4-28. Date mask field definitions

$opts['fdd']['col_name']['datemask'] = 'r';
Note that currently only fields displaying is implemented. Entering date fields concerning to these masks will be implemented in the nearly future.

Number format

Use this option to get a formatted version of number. It uses number_format() PHP function. Option accepts an array with one or three elements.

The first array member defines the number of decimals in formatted number, the second member specifies the character before decimals and the last array member means separator between every group of thousands.

Example 4-29. Number format example

$opts['fdd']['col_name']['number_format'] = array(2, '.', ',');

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov