array_push($treeIds, $catKey); $subcatIds = '(' . implode(',', $treeIds) . ')'; $sql = "SELECT lid, cid, title, hits, rating, votes FROM " . "" . $xoopsDB->prefix("mylinks_links") . "" . " WHERE status>0 AND cid IN {$subcatIds} WHERE {$sortDB}>0 ORDER BY {$sortDB} DESC LIMIT 0,10"; $result = $xoopsDB->query($sql); if ($result) { $catTitle = $myts->htmlSpecialChars($mainCatTitleArray[$catKey]['title']); $rankings[$catKey]['title'] = sprintf(_MD_MYLINKS_TOP10, $catTitle); $rank = 1; while (list($lid, $lcid, $ltitle, $hits, $rating, $votes) = $xoopsDB->fetchRow($result)) { $thisCatObj = $mylinksCatHandler->get($lcid); $homePath = "<a href='" . XOOPSMYLINKURL . "/index.php'>" . _MD_MYLINKS_MAIN . "</a> : "; $itemPath = "<a href='" . XOOPSMYLINKURL . "/viewcat.php?cid={$lcid}'>" . $thisCatObj->getVar('title') . "</a>"; $path = ''; $myParent = $thisCatObj->getVar('pid'); while ($myParent != 0) { $ancestorObj = $myCatTree->getByKey($myParent); $path = "<a href='" . XOOPSMYLINKURL . "/viewcat.php?cid=" . $ancestorObj->getVar('cid') . "'>" . $ancestorObj->getVar('title') . "</a> : {$path}"; $myParent = $ancestorObj->getVar('pid'); } $path = "{$path}{$itemPath}"; $path = str_replace(" : ", " <img src='" . mylinksGetIconURL('arrow.gif') . "' style='border-width: 0px;' alt='' /> ", $path); $thisRanking = array('id' => $lid, 'cid' => $catKey, 'rank' => $rank, 'title' => $myts->htmlSpecialChars($ltitle), 'category' => $path, 'hits' => $hits, 'rating' => number_format($rating, 2), 'votes' => $votes); $rankings[$catKey]['links'][$rank] = $thisRanking; $rank++; } } } $rankings = empty($rankings) ? '' : $rankings; $xoopsTpl->assign('rankings', $rankings); unset($rankings); //wanikoo theme changer