Class reference table - variablenHandler
The class variablenHandler is used to register variables from the REQUEST locally.
In this case, default values can be assigned to form the execution of a program more savely and
more deterministic. This particular makes sense in applications with check box fields or other
sequence control variables. Besides, the variablenHandler accesses the super
global array $_REQUEST and extracts the offset contained there in a locally used array.
The variable $_LOCALS is usually used to mark that the contents were provided with the
variablenHandler component and do not correspond to the global array. The following
example shows how the values of "action" and "subaction" are extracted into the array
$_LOCALS and "action" is preset with the default value "none", if it was not included in
the request:
$_LOCALS = variablenHandler::registerLocal(array( 'Action' => 'none', 'Subaction' => 'none' ) );
With the use of the variablen handler it is always made sure that the locally registered variables
are available. A check like
if(isset($_REQUEST['Action'])){
// ... //
// end if }
is not necessary any more. To use this class it must be imported by
import('tools::variablen','variablenHandler');
prior to use.
Comments
Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.
|