как использовать smarty в аддоне WHMCS

Я пытаюсь разработать надстройку для своего WHMCS, используя API 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

person Marcel    schedule 01.11.2015    source источник


Ответы (1)


Ваш путь к шаблону правильный? Я думаю, что вам не хватает public_html в пути к шаблону.

person Aamir Sarwar    schedule 06.11.2015