This is untested, and possibly not 100% correct, but the theory is there

.
You'll need to do something like this:
Code:
<?php
require("forums/global.php");
$DB_site->query("SELECT all, of, the, things, you, want, FROM table WHERE yadda, yadda");
eval("echo(\"".gettemplate("template_name")."\");");
?>
The theory is that you'd include global.php, connect to the database, and call the template you want.
That's the best I can do off the top of my head. The code depends on what is it you want to do more than anything else.
-jim