2017-08-02 98 views
0

我很努力地访问自定义变量我使用WHMCS API发送电子邮件时的设置... 请参阅下面的API命令以及smarty标签我正在使用尝试和显示数组。如何在WHMCS电子邮件中访问Smarty模板中的自定义变量

我尝试了好几种不同的方法,但不能访问我所定义的数组...

任何援助将不胜感激:)。

API命令

$results = localAPI("SendEmail", ['messagename'=>'My Email Template', 'id'=>$client->userid, 'customvars' => ['myvariables' => ['test_var_1'=>'value 1', 'test_var_2'=>'value 2']]]); 

Smarty的模板语法我试过

{foreach from=$myvariables item=custom_field} 
    {$custom_field.test_var_1} 
{/foreach} 

我收到什么尽管在电子邮件...我也试过

{foreach from=$client_custom_fields.myvariables item=custom_field} 
    {$custom_field.test_var_1} 
{/foreach} 

回答

0

我犯了d使用smarty调试标签,然后在电子邮件消息日志中查看电子邮件,以准确查看变量的发送位置。只需添加:

{debug} 

给身体如果你的模板。

相关问题