InitTableVarsForEdit
CDatabase::InitTableVarsForEdit( string tablename, string IdentFrom = "str_", string IdentTo = "str_", string SuffixFrom = "", bool Always = false )
The method creates global variables with ${prefix_to.field_name} names and assigns them values of variables with ${prefix_from.field_name.postfix_from}, additionally converting into HTML safe format. The "field_name" are the table field names.
The method operates variables of the global scope. Keep this fact in mind when creating main files of components.
Non-static method.
Parameters
Parameter | Description | Available from version |
---|---|---|
tablename | Table name. | |
IdentFrom | Prefix for variables FROM which the converting is performed.
Optional; "str_" by default. | |
IdentTo | Prefix for variables TO which the converting is performed.
Optional; "str_" by default. | |
SuffixFrom | Suffix (postfix) for variables FROM which the converting is performed.
Optional; "str_" by default. | |
Always | "True" value - create variables are always initialized, i. e. independently from their initial status.
Optional; "false" by default. |
See Also
Examples of use
<? $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_"); ?>
© «Bitrix24», 2001-2024