I've added a template named it as 'test_template' now how to use its variable? i.e. Like mybb uses, {$boardstats} in index.php to get the boardstats template.
You need to eval the template and globalize it through a plugin.
How to make it globalize?
function test_activate(){
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", "#".preg_quote('{$forums}')."#i", '<td>{$forums}{$mytest}');
$mytest_template='
<style>
#title{
background:green;
}
</style>
<span id="title"> This is a test title </span>';
// insert templates
$db->insert_query('templates', array('title' => 'mytest_template', 'sid' => '-1', 'template' => $db->escape_string($mytest), 'version' => '1411', 'status' => '', 'dateline' => TIME_NOW));
rebuild_settings();
}
}