本文整理匯總了PHP中TemplateEngine::loadTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP TemplateEngine::loadTemplate方法的具體用法?PHP TemplateEngine::loadTemplate怎麽用?PHP TemplateEngine::loadTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TemplateEngine
的用法示例。
在下文中一共展示了TemplateEngine::loadTemplate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendSystemEmailFromTemplate
/**
* Sends an e-mail (text format) from the system to the specified recipient.
* Difference to sendSystemEmail(): Content is extracted from a template file.
*
* @param WebSoccer $websoccer current context.
* @param I18n $i18n messages context
* @param string $recipient recipient e-mail address
* @param string $subject Already translated e-mail subject.
* @param string $templateName name of template (NOT template file name, i.e. WITHOUT file extension!) to use for the e-mail body.
* @param array $parameters array of parameters to use in the template (key=parameter name, value= parameter value).
*/
public static function sendSystemEmailFromTemplate(WebSoccer $websoccer, I18n $i18n, $recipient, $subject, $templateName, $parameters)
{
$emailTemplateEngine = new TemplateEngine($websoccer, $i18n, null);
$template = $emailTemplateEngine->loadTemplate('emails/' . $templateName);
$content = $template->render($parameters);
self::sendSystemEmail($websoccer, $recipient, $subject, $content);
}