3
Chapi has given the solution, however, smarty is exactly designed to keep code and design seperated.
You better might want to 'import' the script to xoops, and dump the final output into a smarty var.
$xoopsTpl->assign('var_to_smarty', $your_var);
You can then call it by <{$var_to_smarty}>