2017-08-02 93 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} 

給身體如果你的模板。

相關問題