Xoops加入特征搜索
来自站长百科
导航: 上一页 | 首页 | DedeCMS | 帝国CMS | Drupal | PHPCMS | PHP168 | Joomla | PowerEasy | SupeSite
在xoops_version.php中声明搜索函数[ ]
在/modules/foo/xoops_version.php文件中加入下面的命令:
// Search $modversion['hasSearch'] = 1; $modversion['search']['file'] = "include/search.inc.php"; $modversion['search']['func'] = "foo_search";
创建搜索函数[ ]
在/modules/foo/include/中创建search.inc.php文件:
function foo_search($queryarray, $andor, $limit, $offset, $userid, $sortby = "foo_term ASC") { global $xoopsDB, $xoopsConfig, $myts, $xoopsUser; … $sql = "SELECT foo_id, foo_term FROM " . $xoopsDB->prefix("foo_foo "); … $result = $xoopsDB->query($sql, $limit, $offset); while ($myrow = $xoopsDB->fetchArray($result)) { $ret[$i]['link'] = … $ret[$i]['title'] = …; … } … return $ret; }