if that template is displayed when index.php is run, all you need to do is to add the variables into the template, that's it.
If you try to display the templates inside other .php files (eg. forumdisplay.php), you have to put their code into that php files. And this is :
PHP Code:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");