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

Tzvook,

I suggest the same as tripmon, and basically what is done in the phpNuke solution. For example around line 108 in your index.php file change the query line to:

if (isset($_GET['letter'])) {
$letter = $_GET['letter'];
$result = $xoopsDB->query("SELECT l.lid, l.cid, l.title, l.address, l.address2, l.city, l.state, l.zip, l.country, l.phone, l.fax, l.email, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, l.premium, t.description FROM ".$xoopsDB->prefix("xdir_links")." l, ".$xoopsDB->prefix("xdir_text")." t where t.title LIKE ".$letter."% AND l.status>0 and l.lid=t.lid ORDER BY date DESC", $xoopsModuleConfig['newlinks'], 0);
} else {
$result = $xoopsDB->query("SELECT l.lid, l.cid, l.title, l.address, l.address2, l.city, l.state, l.zip, l.country, l.phone, l.fax, l.email, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, l.premium, t.description FROM ".$xoopsDB->prefix("xdir_links")." l, ".$xoopsDB->prefix("xdir_text")." t where l.status>0 and l.lid=t.lid ORDER BY date DESC", $xoopsModuleConfig['newlinks'], 0);
}

When you have a letter in your GET variables the query should only receive the links with a title starting with that letter.

If this principle works for you you can use it in the files you need, such as viewcat.php etc.

Martijn

22
tzvook
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/29 9:04

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


10x for the answere wtravel
Got to go, will try it when I'll come back

how do I pass the "GET" to a url? ...
Hope it can be implemented in all modules ....
If so - a great problem is solved for a lot of modules...

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

Example GET variable:

index.php?letter=B

GET variable name in this example is "letter".
GET variable = "B".

Martijn

24
tzvook
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/29 9:13

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Sorry about the dumb question
I meant if the get is @ the URL .... of course .... shame on me

25
tripmon
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/29 9:17

  • tripmon

  • Module Developer

  • Posts: 462

  • Since: 2004/2/28


lol, didn't even glance at the nuke code.

I'm coding some wap stuff for AMS right now, but will post back here once I get to the dir pages.

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

Ah ....

If you look at the letters function in the functions.php file, you will see this code:

$letterchoice .= "$ltr";

So if you change the example I sent you to $_GET['list'] instead of $_GET['letter'] and if change $letter to $ltr, you are there. The letters function should create the aplphabetical list correctly then.

Martijn

Martijn

27
tzvook
Re: Xdirectory Alphabetic Order Hack ... need fresh eyes
  • 2005/3/29 13:55

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Hello Martijn & tripmon

I came back and gave it some tries (A Lot)
not working like it needs

I made the changes, but ... if I change the index.php and the "alphabetic sort panel" leads to the "viewlist.php" it's probably not helping, so I made a lot of tries, tried the index.php?list=a , tried to change the viewlist as you said for the index.php ... and, non worked

Now, let me describe the problem again - kinda weird:

First of all I raised the value of 50 results to 500 results (I have 600 records)

clicking the "a" gives me results for a , b , c , d . (by that order)
Clicking the b , c or d gives the same results
Clicking on the "e" gives me the "e" and the "g" results
Clicking on the "f" gives me just the "f"
and so on ......

Weird ... yep ... I try to deal with it for monthes , but I kinda lost and despert

I saw that the PHPnuke code (towards the end of it .... did something else ... something with counting the results ... limiting ?

The WFteam also noticed that behaviour, but couldn't say why or fix it. (dealing with it embeded in the WFdownloads)

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

Think I found the cause of it...fingers crossed.

In your viewlist.php you have a query
Quote:

$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]."";
}

This will try to get all listings starting with the letter in your url as well as all the listings of the children categories of the main categories' listings. So this includes listings that start with other letters.

I think if you only use the query to get the listings that start with the selected letter, you will get what you want.

Martijn

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

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Thinking again ... there's might be a logic in here.

The records were inserted to the database from the begining from the letter "a" and forward (with exeptions here and there ... (by record's "title" which the sorting goes acordingly)

but then .... why some letters work good and some don't ?

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

A bit weird indeed, but perhaps the good old

echo $query;

after: $query .= ") order by ".$sortDB." DESC";

might show you what exactly the queries look like. I assume you are using a test site

Martijn
---

Login

Who's Online

344 user(s) are online (260 user(s) are browsing Support Forums)


Members: 0


Guests: 344


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