12
OK, I got it working. I thought I needed to include all the XOOPS header stuff but I really didn't. I'm still fuzzy on that subject. All I had to do is:
function myMenu($which) {
global $xoopsDB;
require_once XOOPS_ROOT_PATH."/class/template.php";
$xoopsTpl = new XoopsTpl;
require XOOPS_ROOT_PATH."/class/xoopsformloader.php";
$form = new XoopsThemeForm("", "buttonmenuform", "index.php");
//
// Read the menu options from the db and make an array of associative arrays (idx)
// then shove the array into a template container for use by a template script
//
$sql = 'SELECT id,label,op,file,template, title
FROM '.$xoopsDB->prefix('bdr_buttons').'
WHERE grp = '.$which.'
ORDER BY id';
$result = $xoopsDB->query($sql);
$i = 0;
$row = array();
$idx = array();
while(list($id,$label,$op,$file,$template, $title) = $xoopsDB->fetchRow($result)) {
$row['label'] = $label;
$row['op'] = $op;
$row['source'] = $file;
$idx[$i] = $row;
$i++;
$xoopsOption['template_main'] = $template;
$xoopsTpl->assign('title',$title);
}
$xoopsTpl->append('idx',$idx);
$form->assign($xoopsTpl);
$xoopsTpl->display('db:'.$xoopsOption['template_main']);
}
Thanks for the ideas that led me here...
Doug P