Using the Smarty Template Engine for your Custom WHMCS Addon Module

If you ever wondered how one uses the Smarty template engine in conjunction with WHMCS’s _output function for custom addon modules, here’s a snippet that you can use for WHMCS 5.3.x and PHP 5.3.x:


function _setup_template() {
global $templates_compiledir;
$template = new Smarty();
$template->compile_dir = $templates_compiledir;
$template->template_dir = __DIR__ . DIRECTORY_SEPARATOR . 'templates';
return $template;
}

Include this in your functions file or whatnot and be on your merry way on creating WHMCS modules for your business! *cough* *cough*