Metainformationen zur Seite

LBWeb::mslist_select_html

$html = LBWeb::mslist_select_html( @params );

 

Returns ready HTML code for a Miniserver dropdown list. You can pre-select the current configured Miniserver from a config file.

LoxBerry Compatibility

This function is available starting with LoxBerry V1.2.4. If you use that function, set this minimum version in your plugin.cfg.

The function returns a string with HTML code to show a user dropdown to select a Miniserver. With parameters, you can control the label and the visuals, and you can provide the current configured Miniserver number to be pre-selected.

To give parameters to the function, use named parameters in an array.

Parameter

Case sensitivity

All parameter names are case-sensitive and written in capital letters.

ParameterOptionalUsage
LABEL x By default, no label is used for the dropdown.

To prefix the dropdown with a label, use the LABEL parameter.
FORMID x This is the name and id of the form element. This name is used on submitting a form, or reading the value with JavaScript.

Default is "select_miniserver".
SELECTED x Send the Miniserver number that should be pre-selected (e.g. from a config file).

The function defaults to "1", if the number you've provided does not exist, or you haven't used the parameter.
DATA_MINIx By default, the function uses the jQuery Mobile tag data-mini="true". To have the full-sized button, send DATA_MINI ⇒ "0".

Return value

Returns a string that is the HTML code for the Miniserver dropdown. Simply echo the result of the function to your webpage.

If the user has no Miniservers defined, the HTML does not contain a select list, but a string that no Miniservers are defined.

Usage

require_once "loxberry_web.php";
$mshtml = LBWeb::mslist_select_html( ['FORMID' => 'msno', 'SELECTED' => 2, 'DATA_MINI' => 0 ]);
 
echo $mshtml;

Take attention to the square brackets inside of the round brackets in the function call. It sends an array with the parameters to the function. Also take attention that the parameters must be in quotes.