getTpl("category"); $template->replaceVars(array("{TITLE}" => $r['title'])); $template->publish(); //select forums in this category.. $sql2 = "SELECT * FROM .... WHERE `parent` = '".$r['id']."' "; while($s = mysql_fetch_array($sql2)) { $template->getTpl("forums"); $template->replaceVars(array("{TITLE}" => $s['title'])); $template->publish(); } } //Note all the templates must not contain table tags... ?>