AddPosting
Description and parameters
void
CPostingTemplate::AddPosting(
array arRubric
);
Method for generating template-based message. Static method.
First, systems searches and connects a template language file. Search is performed by the path <template>>/lang/<site language ID with associated campaign>/template.php. Next, template is executed (system connects the file <template>>/lang/template.php). The complete template display becomes an email body and array returned from it becomes message fields.
In case template didn't return an array, but false, message won't be created. Simultaneously, creates the generated message time stamp.
In case this array has a FILES element, attachments are added to the issued message. Array elements must be format arrays:
Array(Array of this tupe may be generated using the function CFile::MakeFileArray.
"name" => "file name",
"size" => "size",
"tmp_name" => "temporary server path",
"type" => "uploaded file type");
If this array has an element DO_NOT_SEND and its value is set as "Y", the subscription won't be sent. Can be used for debugging the generation or premoderating automatic messages.
Parameters
Parameter | Description | Available from version |
---|---|---|
arRubric | Array with values "Subscription" object fields and additional fields:
SITE_ID - subscription site ID; START_TIME - time of previous template launch in the current site "FULL" format; END_TIME - time of current template launch in the current site "FULL" format. |
Returned values
None.
Example
$rubrics = CRubric::GetList(array(), array("ID"=>$ID));
if($arRubric=$rubrics->Fetch())
{
$arRubric["START_TIME"] = $START_TIME;
$arRubric["END_TIME"] = $END_TIME;
$arRubric["SITE_ID"] = $arRubric["LID"];
CPostingTemplate::AddPosting($arRubric);
}