OK, Make a template with this code;
Now use this following code to evaluate this template;
And finally, use this variable: $VARIABLE and place it in the template where you want the template code to show.
require MYBB_ROOT."/inc/adminfunctions_templates.php";
$template = array(
"title" => "TEMPLATE_NAME",
"template" => 'TEMPLATE_CODE',
"sid" => -1
);
$db->insert_query("templates", $template);
Now use this following code to evaluate this template;
eval("\$VARIABLE = \"".$templates->get("TEMPLATE_NAME")."\";");
And finally, use this variable: $VARIABLE and place it in the template where you want the template code to show.