31
tzvook
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/29 14:59

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


That's the query (yep ... a winXP+apach 2 dev site ...)

select lidcidtitlephonehitsratingvotes from xoops2_xdir_links where status>and (title LIKE 'a'order by rating DESCselect lidcidtitlephonehitsratingvotes from xoops2_xdir_links where status>and (title LIKE 'a'order by rating DESC

32
wtravel
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes

So it comes up with only 2 queries, which implies there are only 2 main categories, and none of them have child categories.

I wonder where the '%'sign went.

Martijn

33
tzvook
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/29 15:41

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Sorry Martijn
the sign was there !!!
just another check and forgot to put it back to the code ...

34
wtravel
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes

Ok, if there are only 2 queries, it does seem to imply that there are only 2 main categories. Is this correct?

Martijn

35
tzvook
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/29 16:31

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Yep, correct !!!

36
wtravel
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes

Let's focus on getting it the way you want the script to work. In the viewlist.php file, do you want to show only listings based on chosen letter or do you want to combine it for example with the variable 'catid'. So for example all listings starting with letter 'a' and having catid '2'.

Or do you just want the listings per letter?

Martijn

37
tzvook
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/29 21:33

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Quote:

wtravel wrote:
Let's focus on getting it the way you want the script to work. In the viewlist.php file, do you want to show only listings based on chosen letter or do you want to combine it for example with the variable 'catid'. So for example all listings starting with letter 'a' and having catid '2'.

Or do you just want the listings per letter?

Martijn


just the listings per letter .

38
wtravel
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes

Great, then I will adjust the viewlist.php file a bit a bit, send you the code and let's see if it works, okay?

Martijn

39
wtravel
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes

Let's see if this works on: viewlist.php?list=a

Quote:

// $Id: topten.php,v 1.7 2003/03/25 11:08:22 buennagel Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <https://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'];
$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("/"," » ",$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';
?>

40
tzvook
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/30 9:32

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Hi Martijn

This one gives a blank page, problem is here:

//while(list($cid, $ctitle)=$xoopsDB->fetchRow($result)){


so I put a
{
instead, but it give the same results .... behave wrong like b4 ...

Do you heve a test server? do you want me to pack the Xdir under another name+dir+database tables for you to install the module and test without touching your existing Xdir ????

Quite fastrating this one .... isn't it ?

Login

Who's Online

430 user(s) are online (337 user(s) are browsing Support Forums)


Members: 0


Guests: 430


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits