本文整理汇总了PHP中EmailTemplate::write方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::write方法的具体用法?PHP EmailTemplate::write怎么用?PHP EmailTemplate::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailTemplate
的用法示例。
在下文中一共展示了EmailTemplate::write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getByCode
/**
* Get an email template by code
*
* @param string $code
* @return EmailTemplate
*/
public static function getByCode($code)
{
$template = EmailTemplate::get()->filter('Code', $code)->first();
if (!$template) {
$template = new EmailTemplate();
$template->Title = $code;
$template->Code = $code;
$template->Content = 'Please replace the content of this email';
$template->write();
}
return $template;
}
示例2: getByCode
/**
* Get an email template by code
*
* @param string $code
* @return EmailTemplate
*/
public static function getByCode($code)
{
$template = EmailTemplate::get()->filter('Code', $code)->first();
// If subsite, fallback to main site email if not defined
if (!$template && class_exists('Subsite') && Subsite::currentSubsiteID()) {
Subsite::$disable_subsite_filter = true;
$template = EmailTemplate::get()->filter('Code', $code)->first();
Subsite::$disable_subsite_filter = false;
}
// In dev mode, create a placeholder email
if (!$template) {
$template = new EmailTemplate();
$template->Title = $code;
$template->Code = $code;
$template->Content = '';
$template->write();
}
return $template;
}