Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Premium links

Quote Reply
Premium links
It's it possible to make a link a premium.

I made a field called isPremium in the setup and I made changes in the way links.pm
sort:

$LINKS{build_sort_order_category} = "isPremium,isNew,isPopular,Title";

That makes the links with isPremium go to
the end of the list precisly opposite of what
intended.

$LINKS{build_sort_order_category} = "isNew,isPopular,Title,isPremium";

This doesn't make any differences at all.

I know there is a code you can put before the
title (something like <!1> ), when I tried this the link appeared before all the other links besides the links which starts with a number. (I used the right code so it's not
caused by a wrong code).

Please
help me. Thanks

[This message has been edited by Martin Kjeldsen (edited February 01, 2000).]

[This message has been edited by Martin Kjeldsen (edited February 01, 2000).]
Quote Reply
Re: Premium links In reply to
You need to do:

$LINKS{build_sort_order_category} = "isPremium DESC,isNew,isPopular,Title";

DESC = descending, ASC = ascending

There is a minor bug with this, which has been pointed out to Alex, but he hasn't decided on the fix for it.

If you have links in alternate categories, they can screw up the sort/display order because of how they are "merged" into the hit list.

I may post a workaround once I catch up, using temporary tables, but it will incur a performance hit, and is good only for builds, not for searches (I would imagine)





------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Premium links In reply to
Hi,

Pugdog thank you for the help, but it doesn't
work right. Both ASC og DESC puts the selected test link in the end of the list.

Is this caused by the bug you're talking about or what?
Quote Reply
Re: Premium links In reply to
There could be a lot of reasons for it, actually. The first things you should check, are make sure that all the links have a value in that field. A numeric value is really best, you can set non-premium to 0 and premium to 10 (and be able to split hairs if you want).

The next thing -- is if you are trying to do this on a "search" it won't work. Search overrides to "score" as the sort order.

If a lot of your links are in "alternate" categories, then yes, the bug I mentioned could be the reason. It drove me crazy for a long, long time, until I realized what was going on.

You can check on it by creating a new category, and adding a few dummy links directly to it. Set up the links so they will sort in one order using the other criteria, then reverse the "priority" field so that will force it to sort in reverse order. Re-build, and see what happens. If the sort works, the problem is lots of alternate links.

BTW... if the order of the priority links changes if use ASC / DSC but they stay at the end of the list, then it is most likely the "bug" biting you.






------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Premium links In reply to
Hi Pugdog,

I did as you told me and added links to
an empty category. It works there a link which
starts with a d is before those with a or 1.

But it still don't work in the one with alternate categories and that's still a problem. In the search it doesn't matter how
it sorts I'm not going to use that.

How do you sort correctly then when you got
a lot of your links is in alternate categories.

Martin

Quote Reply
Re: Premium links In reply to
Right now you can't ....

Alex understands the problem, and two distinct solutions have been proposed.

I'm not sure which he favors, but the quick and dirty hack is to use a temporary table to extract both the links and alt-links, then sort that. It makes it a 2-3 step process during a build, but that's all. The elegant solution is to rewrite the core logic of alt-links. On a small database, the performance hit with temporary tables should be reasonable. On larger databases, it could be unacceptable... I don't know.



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/