UNA
BxDolEmailTemplates Class Reference
Inheritance diagram for BxDolEmailTemplates:
BxDolFactory iBxDolSingleton

Public Member Functions

 __clone ()
 
 getTemplate ($sTemplateName, $iAccountId=0)
 
 parseTemplate ($sTemplateName, $aTemplateKeys, $iAccountId=0, $iProfileId=0)
 

Static Public Member Functions

static getInstance ()
 

Detailed Description

Email templates are used to send preformated messages.

Email templates are multilingual.

User is sent email in language which is defined in their account, if account language is not set - then default site language is used.

Email templates use template system, so it is possible to customize header/footer via Studio -> Polyglot -> Emails header/footer

1-click unsubscribe link is added automatically to every email (except a few system emails, which is not supposed to unsubscribe from, like forgot password email). Please note: make sure that {unsubscribe} marker is not removed, or unsubscribe link will not be added.

Example of usage

Send an email using email templates:

// define custom template variables
$aPlus = array();
$aPlus['email'] = 'ktoto@example.com';
$aPlus['conf_code'] = '123456';
$aPlus['conf_link'] = BX_DOL_URL_ROOT . 'page.php?i=confirm-email&code=123456';
$aPlus['conf_form_link'] = BX_DOL_URL_ROOT . 'page.php?i=confirm-email';
$aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('t_Confirmation', $aPlus); // get class instance and parse template
if ($aTemplate && sendMail('ktoto@example.com', $aTemplate['Subject'], $aTemplate['Body'])) // send email if template exists
echo 'email was successfully sent';
else
echo 'email send failed';

Member Function Documentation

◆ __clone()

BxDolEmailTemplates::__clone ( )

Prevent cloning the instance

◆ getInstance()

static BxDolEmailTemplates::getInstance ( )
static

Get singleton instance of the class

Implements iBxDolSingleton.

◆ getTemplate()

BxDolEmailTemplates::getTemplate (   $sTemplateName,
  $iAccountId = 0 
)

Function will return array of needed template ;

Parameters
string$sTemplateName- name of necessary template.
integer$iAccountId- account ID of registered member.
Returns
array with template 'Subject' and 'Body'.

◆ parseTemplate()

BxDolEmailTemplates::parseTemplate (   $sTemplateName,
  $aTemplateKeys,
  $iAccountId = 0,
  $iProfileId = 0 
)

Function will return array of needed template with neccessary markers replaced ;

Parameters
string$sTemplateName- name of necessary template.
string$aTemplatekeys- key ane value pairs to replace in subject and body.
integer$iAccountId- account ID of registered member.
integer$iProfileId- profile ID of registered member.
Returns
array with template 'Subject' and 'Body'.

The documentation for this class was generated from the following file: