Bitrix Site Manager

CDatabase::InitTableVarsForEdit

CDatabase::InitTableVarsForEdit(
 string table,
 string prefix_from = "str_",
 string prefix_to = "str_", 
 string postfix_from = "", 
 bool init_anyway = false 
 )

The method InitTableVarsForEdit creates global variables with names ${prefix_to.field_name} and sets its values to those of variables ${prefix_from.field_name.postfix_from}. The "field_name" parts are field names of the table. The variables created are HTML safe.

Note
The method operates variables of the global scope. Keep this fact in mind when creating main files of components.

Parameters

ParameterDescription
table Table name.
prefix_from Prefix of the source variables. Optional; "str_" by default.
prefix_to Prefix of the variables to be created. Optional; "str_" by default.
postfix_from Suffix of the source variables. Optional; the default value is an empty string.
init_anyway If true, the variables created are always initialised with no respect to their existence . Optional; false by default.

See Also

Example



<?
$stoplist = CStoplist::GetByID($ID);
if (!($stoplist && $stoplist->ExtractFields()))
{
    $ID=0; 
    $str_ACTIVE="Y";
    $str_MASK_1="255";
    $str_MASK_2="255";
    $str_MASK_3="255";
    $str_MASK_4="255";
    $str_IP_1 = $net1;
    $str_IP_2 = $net2;
    $str_IP_3 = $net3;
    $str_IP_4 = $net4;
    $str_USER_AGENT = $user_agent;
    $str_DATE_START=GetTime(time(),"FULL");
    $str_MESSAGE = GetMessage("STAT_DEFAULT_MESSAGE");
    $str_MESSAGE_LID = LANGUAGE_ID;
    $str_SAVE_STATISTIC = "Y";
}
if (strlen($strError)>0) $DB->InitTableVarsForEdit("b_stop_list", "", "str_");
?>