$arParams is the predefined variable containing an array of the component input parameters. Keys are the names of parameters, and the values are parameter values.
Before the component is activated, htmlspecialcharsEx is called on values of all parameters.
The original parameter values are stored in this array but have the prefix of
tilde "~". For example, $arParams["NAME"] is an input parameter processed
with htmlspecialcharsEx, and
The variable $arParams is a reference to the corresponding component class member, so all changes to this variable affect the class member. On startup, the component should verify input parameters, initialize variables, cast types (e.g. IntVal). The template will have access to these altered parameters; that is, parameters will be verified and safe. The template does not have to verify and prepare parameters again.
$arResult is the predefined variable accumulating the component's output before trensferring it to the template. Before the component is activated, this variable is set to an empty array().
$arResult is a reference to the corresponding component class member, so all changes to this variable affect the class member. Do not pass this variable to the template explicitly; it is performed by the component internal logic.
PHP references are used to address a piece of information by different names. All changes to $arParams and $arResult will be available in the template as well.
References are powerful, but you may come across some pitfalls.
$arParams = & $arSomeArray;unbinds $arParams from the component class member and attaches it to $arSomeArray. In this case, all changes to $arParams will not affect the component template.
unset($arParams);also breaks relationship between $arParams and the component class member.
© 2001-2007 Bitrix | Bitrix Site Manager |