2015-11-01 70 views
1

我正在嘗試使用WHMCS API和smarty爲我的WHMCS開發插件。如何在WHMCS插件中使用smarty

我已經創建了模塊,現在加載我創建新的$ smarty實例,然後嘗試加載addon_name/template目錄中的模板文件,但我無法。

下面是我的代碼和我的錯誤:

WHMCS輸出:

function statement_generator_output($vars) { 
     include('mainform.php'); 
} 

Mainform.php:

<? 

require_once '/home/account/public_html/hosting/vendor/smarty/smarty/libs/Smarty.class.php'; 

$smarty = new Smarty; 

//$smarty->force_compile = true; 
$smarty->debugging = true; 
$smarty->caching = false; 
$smarty->cache_lifetime = 120; 

$smarty->assign("action", 'hello'); 

$smarty->display('/home/account/hosting/modules/addons/statement_generator/template/statement_generator.tpl'); 

?> 

錯誤:

Fatal error: Uncaught --> Smarty: Unable to load template file '/home/account/hosting/modules/addons/statement_generator/template/statement_generator.tpl' <-- thrown in /home/account/public_html/hosting/includes/classes/WHMCS/Terminus.php on line 0 

回答

0

您的模板路徑正確嗎? 我想你是缺少public_html模板路徑