如何在WHMCS插件中使用smarty

时间:2015-11-01 20:45:28

标签: php whmcs

我正在尝试使用WHMCS API为我的WHMCS开发一个插件并且很聪明。

我创建了模块,现在加载时我创建了新的$ 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

1 个答案:

答案 0 :(得分:0)

您的模板路径是否正确? 我认为您在模板路径中缺少 public_html