12
This is what the full function is. I see the query but don't know how to implement into my theme.html. Could you please instruct. Thanks
function display_menus()
{
global $xoopsDB, $myts, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsTpl, $groups, $gperm_handler;
/**
* get menu items if current page is default
*/
if ($xoopsModuleConfig['displaymenu'] == 1)
{
$result2 = $xoopsDB->query("SELECT CID, pagetitle, pageheadline FROM " . $xoopsDB->prefix("xtrapages_01") . " WHERE (publishdate > 0 AND publishdate <= " . time() . ") AND (expiredate = 0 OR expiredate > " . time() . ") AND defaultpage = '0' AND mainpage = '1' ORDER BY weight");
$total['total'] = $xoopsDB->getRowsNum($result2);
while ($query_data = $xoopsDB->fetcharray($result2))
{
if ($gperm_handler->checkRight('Page Permissions' , $query_data['CID'], $groups, $xoopsModule->getVar('mid')))
{
$chanlink['id'] = "?pagenum=".$query_data['CID'];
$chanlink['pagetitle'] = $myts->displayTarea(trim($query_data['pagetitle']));
if (empty($query_data['pagetitle']))
{
$chanlink['pagetitle'] = $myts->displayTarea(trim($query_data['pageheadline']), 1);
}
$xoopsTpl->append('chanlink', $chanlink);
}
}
$result3 = $xoopsDB->query("SELECT mainpage, titlelink FROM " . $xoopsDB->prefix("xtrapages_01linktous") . "");
list($linktous, $titlelink) = $xoopsDB->fetchrow($result3);
if (intval($linktous) == 1)
{
if (is_object($xoopsUser))
{
$chanlink['id'] = "?op=link";
$chanlink['pagetitle'] = $myts->displayTarea(trim($titlelink),1);
$xoopsTpl->append('chanlink', $chanlink);
}
elseif ($xoopsModuleConfig['anonlink'])
{
$chanlink['id'] = "?op=link";
$chanlink['pagetitle'] = $myts->displayTarea(trim($titlelink),1);
$xoopsTpl->append('chanlink', $chanlink);
}
}
$result4 = $xoopsDB->query("SELECT mainpage, titlerefer FROM " . $xoopsDB->prefix("xtrapages_01refer") . "");
list($referafriend, $refertitle) = $xoopsDB->fetchrow($result4);
if (intval($referafriend) == 1)
{
if (is_object($xoopsUser))
{
$chanlink['id'] = "?op=refer";
$chanlink['pagetitle'] = $myts->displayTarea(trim($refertitle),1);
$xoopsTpl->append('chanlink', $chanlink);
}
elseif ($xoopsModuleConfig['anonrefer'])
{
$chanlink['id'] = "?op=refer";
$chanlink['pagetitle'] = $myts->displayTarea(trim($refertitle),1);
$xoopsTpl->append('chanlink', $chanlink);
}
}
}
}