Documentation

InitFilterEx

InitFilterEx(
 array vars,
 string id, 
 string action = "set", 
 bool session = true
);

The function initializes or saves the filter variables in the session.

Note. The function handles variables from the global scope. It must be considered when creating main component files.

Function parameters

ParameterDescription
vars Array of filter variables names.
id The filter ID identifying this filter in the session array: $_SESSION["SESS_ADMIN"][id]
action The content of action: to copy values or retrieve the filter values. If the value is equal to "set", then the values of variables with names passed in the vars parameter will be copied in their the session array $_SESSION["SESS_ADMIN"][id]. Otherwise these variables will be initialized by the values stored in the session array $_SESSION["SESS_ADMIN"][id].
Optional parameter, equals "set" by default.
session Specifies to use the session. If the value of this parameter is true, the filter values will be stored in the session array $_SESSION["SESS_ADMIN"][id].

See Also

Examples of use

<?
$FilterArr = Array(
    "find_id",
    "find_id_exact_match",
    );

// if "Set filter" button is clicked...
if (strlen($set_filter)>0) 
{
    // remember the filter values in the session
    InitFilterEx($FilterArr,"ADV_BANNER_LIST","set"); 
}
else 
{
    // initialize the filter values from the session
    InitFilterEx($FilterArr,"ADV_BANNER_LIST","get");
}

// if "Reset filter" button is clicked
if (strlen($del_filter)>0) DelFilterEx($FilterArr,"ADV_BANNER_LIST");

$arFilter = Array(
    "ID"                    => $find_id,
    "ID_EXACT_MATCH"        => $find_id_exact_match,
    );
$rsBanners = CAdvBanner::GetList($by, $order, $arFilter, $is_filtered);
?>


© «Bitrix24», 2001-2022
Up