https://xoops.org/modules/newbb/viewtopic.php?topic_id=32229&forum=4&post_id=140621#forumpost140621
This one continue the thread (sorry I didn't post it here ... forgot about this thread)
function letters()
{
global $xoopsModule;
$letterchoice .= "[ ";
$alphabet = array ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
$num = count($alphabet) - 1;
$counter = 0;
while (list(, $ltr) = each($alphabet))
{
$letterchoice .= "<a href='viewlist.php?rate=1&list=$ltr' style='font-size: 11px;'><font size='2'>$ltr</font></a>";
if ($counter == round($num / 2))
$letterchoice .= " ]<br />[ ";
elseif ($counter != $num)
$letterchoice .= " | ";
$counter++;
}
$letterchoice .= " ]";
return $letterchoice;
}
include "header.php";
$myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object
include_once XOOPS_ROOT_PATH."/class/xoopstree.php";
$mytree = new XoopsTree($xoopsDB->prefix("xdir_cat"),"cid","pid");
$xoopsOption['template_main'] = 'xdir_viewlist.html';
include XOOPS_ROOT_PATH."/header.php";
//generates top 10 charts by rating and hits for each main category
$list = $HTTP_GET_VARS['list'];
$rate = $HTTP_GET_VARS['rate'];
// Tzvook //
$letters = letters();
$xoopsTpl->assign('letters', $letters);
$xoopsTpl->assign('xmid', $xoopsModule->getVar('mid'));
if(isset($rate)){
$sort = _MD_RATING;
$sortDB = "rating";
}else{
$sort = _MD_HITS;
$sortDB = "hits";
}
$xoopsTpl->assign('lang_sortby' ,$sort);
$xoopsTpl->assign('lang_rank' , _MD_RANK);
$xoopsTpl->assign('lang_phone', _MD_BUSPHONE);
$xoopsTpl->assign('lang_title' , _MD_TITLE);
$xoopsTpl->assign('lang_category' , _MD_CATEGORY);
$xoopsTpl->assign('lang_hits' , _MD_HITS);
$xoopsTpl->assign('lang_rating' , _MD_RATING);
$xoopsTpl->assign('lang_vote' , _MD_VOTE);
$arr=array();
$result=$xoopsDB->query("select cid, title from ".$xoopsDB->prefix("xdir_cat")." where pid=0");
$e = 0;
$rankings = array();
while(list($cid, $ctitle)=$xoopsDB->fetchRow($result)){
$rankings[$e]['title'] = sprintf(_MD_TOP10, $myts->htmlSpecialChars($ctitle));
$query = "select lid, cid, title, phone, hits, rating, votes from ".$xoopsDB->prefix("xdir_links")." where status>0 and (title LIKE '$list%'";
// get all child cat ids for a given cat id
$arr=$mytree->getAllChildId($cid);
$size = count($arr);
for($i=0;$i<$size;$i++){
$query .= " or cid=".$arr[$i]."";
}
$query .= ") order by ".$sortDB." DESC";
$result2 = $xoopsDB->query($query,50,0);
$rank = 1;
while(list($lid,$lcid,$ltitle,$phone,$hits,$rating,$votes)=$xoopsDB->fetchRow($result2)){
$catpath = $mytree->getPathFromId($lcid, "title");
$catpath= substr($catpath, 1);
$catpath = str_replace("/"," <span class='fg2'>»</span> ",$catpath);
$rankings[$e]['links'][] = array('id' => $lid, 'cid' => $cid, 'rank' => $rank, 'title' => $myts->htmlSpecialChars($ltitle), 'category' => $catpath, 'hits' => $hits, 'rating' => number_format($rating, 2), 'votes' => $votes, 'phone' => $phone);
$rank++;
}
$e++;
}
$xoopsTpl->assign('rankings', $rankings);
include XOOPS_ROOT_PATH.'/footer.php';
?>
<{$letters}>
<p><font style="background-color: #33cc00">my texts here ....</font> text .......<br /><br /><strong><u>Tzvook</u></strong><br /><br /><br /><br /><br /><br /><br /><br /><br /></p><p> </p>
samuels wrote:
@tzvook
As you know Htmlarea has a huge community behind, helping, reporting bugs e.t.c.
Mithrandir wrote:
Replace 5 with the id of the module you want searched.