Here is the code I got so far (remember I'm not a coder)
The
viewlist.php // $Id: topten.php,v 1.7 2003/03/25 11:08:22 buennagel Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
// Hacks provided by: Adam Frick //
// e-mail: africk69@yahoo.com //
// Purpose: Create a yellow-page like business directory for XOOPS using //
// the mylinks module as the foundation. //
// ------------------------------------------------------------------------- //
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'];
// Tzvook //
$letters = letters();
$xoopsTpl->assign('letters', $letters);
if(isset($rate)){
$sort = _MD_RATING;
$sortDB = "title";
}else{
$sort = _MD_HITS;
$sortDB = "title";
}
$xoopsTpl->assign('lang_sortby' ,$sort);
$xoopsTpl->assign('lang_rank' , _MD_RANK);
$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 COUNT(*) FROM ".$xoopsDB->prefix("xdir_cat")." WHERE title LIKE '$list%' AND status>0");
list($numrows) = $xoopsDB->fetchRow($result);
$XDlisting = array();
while(list($cid, $ctitle)=$xoopsDB->fetchRow($result)){
$XDlisting[$e]['title'] = sprintf(_MD_TOP10, $myts->htmlSpecialChars($ctitle));
$query = "select lid, cid, title, hits, rating, votes from ".$xoopsDB->prefix("xdir_links")." where status>0 and (cid=$cid";
// 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." ASC";
$result2 = $xoopsDB->query($query,10,0);
$rank = 1;
while(list($lid,$lcid,$ltitle,$hits,$rating,$votes)=$xoopsDB->fetchRow($result2)){
$catpath = $mytree->getPathFromId($lcid, "title");
$catpath= substr($catpath, 1);
$catpath = str_replace("/"," » ",$catpath);
$XDlisting[$e]['links'][] = array('id' => $lid, 'cid' => $cid, 'rank' => $rank, 'title' => $myts->htmlSpecialChars($ltitle), 'category' => $catpath, 'hits' => $hits, 'rating' => number_format($rating, 2), 'votes' => $votes);
$rank++;
}
$e++;
}
$xoopsTpl->assign('XDlisting', $XDlisting);
include XOOPS_ROOT_PATH.'/footer.php';
?>
my
xdir_viewlist.html template:
<br>
<center>
<p>
<div align = 'center' class = 'itemPermaLink'><{$letters}>div><br />
center>
<br>
<br /><br />
<div style="margin-top: 2px;text-align: center;font-size: 20px;font-weight: bold;">Business Directorydiv>
<br /><br /><br />
<{foreach item=XDlisting from=$XDlistings}>
<table class="outer">
<tr>
<th colspan="6"><{$XDlisting.title}> (<{$lang_sortby}>)th>
tr>
<tr>
<td class="head" width='7%'><{$lang_rank}>td>
<td class="head" width='28%'><{$lang_title}>td>
<td class="head" width='40%'><{$lang_category}>td>
<td class="head" width='8%' align='center'><{$lang_hits}>td>
<td class="head" width='9%' align='center'><{$lang_rating}>td>
<td class="head" width='8%' align='right'><{$lang_vote}>td>
tr>
<{foreach item=link from=$XDlisting.links}>
<tr>
<td class="even"><{$link.rank}>td>
<td class="odd"><a href='singlelink.php?cid=<{$link.cid}>&lid=<{$link.id}>'><{$link.title}>a>td>
<td class="even"><{$link.category}>td>
<td class="odd" align='center'><{$link.hits}>td>
<td class="even" align='center'><{$link.rating}>td>
<td class="odd" align='right'><{$link.votes}>td>
tr>
<{/foreach}>
table>
<br />
<{/foreach}>
I probably made a lot of mess in the code