7
Quote:
urbanspacema wrote:
But xoopstree is deprecated... or not?
Yes.
This is a problem for modules that do not use XOOPS object handlers.
However you can fix it by creating a dummy object that you can use in XoopsObjectTree.
Try something like this:
le="color: #000000"><?php global $xoopsDB; //include once the file where XoopsDummyObject class is. $table_name = 'xoopstube_cat'; $id_name = 'cid'; $pid_name = 'pid'; $title_name = 'title'; $sql = "SELECT * FROM " . $xoopsDB->prefix($table_name); // here goes the table name $result = $xoopsDB->query($sql); while ($row = $xoopsDB->fetchArray($result)) { $objsArray[] = new XoopsDummyObject($row, $id_name, $pid_name, $title_name); } $topic_tree = new XoopsObjectTree($objsArray, $id_name, $pid_name); // better place this on a separate file so you can reuse it class XoopsDummyObject extends XoopsObject { /** * constructor */ function XoopsDummyObject($row, $id_name = 'cid', $pid_name = 'pid', $title_name = 'title') { $this->XoopsObject(); $this->initVar($id_name, XOBJ_DTYPE_INT, $row[$id_name]); $this->initVar($pid_name, XOBJ_DTYPE_INT, $row[$pid_name]); $this->initVar($title_name, XOBJ_DTYPE_TXTBOX, $row[$title_name]); } }