Firstly, you
don't need to eval all those variables. Remember that the scope of all those variables is
local to that function, this results in the problem of nothing showing:
PHP Code:
function showlast5posts($forumpath, $forumid){
global $DB_site;
$getlast5posts = $DB_site->query(" SELECT threadid, title
FROM thread
WHERE forumid = '".intval($forumid)"'
ORDER BY lastpost DESC
LIMIT 5");
while($this5post = $DB_site->fetch_array($getlast5posts)) {
$forumspathe = $forumspath;
$tid = $this5post['threadid'];
$ttitle = $this5post['title'];
eval("\$GLOBALS[last5postsshow] = \"".gettemplate('forumhome_lastpostby')."\";");
}
}
The above is more like what you want. Also note that $templatesused only works
before you have required global.php, so add the template along with the others at the top. Secondly I think using this method is
very bad, especially if you have alot of forums as this adds one query per forum.