Sp0tteh Posted February 4, 2012 Share Posted February 4, 2012 Hey, In the process of creating an addon. However I really don't enjoy having to echo my html and would rather be able to split up the design from the PHP. Is there a way I can use smarty and create a template file that then renders my page as well as the rest of the Admin area (header / footer ect)??? Cheers 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted February 4, 2012 Share Posted February 4, 2012 Not sure if it works with addon modules or not, but you can try returning the template array from the _output() function. return array( 'templatefile'=>'sometemplate', 'breadcrumb'=>'', 'vars'=> array( 'somevar' => $somevalue, 'somevar2' => $someothervalue)); This works with things like server modules. 0 Quote Link to comment Share on other sites More sharing options...
heapmaster Posted September 25, 2012 Share Posted September 25, 2012 Hey, In the process of creating an addon. However I really don't enjoy having to echo my html and would rather be able to split up the design from the PHP. Is there a way I can use smarty and create a template file that then renders my page as well as the rest of the Admin area (header / footer ect)??? Cheers I couldnt find anything on this either, but I figured it out. If you want to use smarty templates for the add-on pages within WHMCS admin area use this code in your functions instead of putting your admin HTML code into the module and doing an echo/print of it. // create object $smarty = new Smarty; // Example assign variable $smarty->assign('name', 'george smith'); $smarty->caching = false; $smarty->compile_dir = $GLOBALS['templates_compiledir']; // display file from template folder within add-on folder $smarty->display(dirname(__FILE__) . '/templates/template-file.tpl'); 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.