Gossamer Forum
Home : Products : Links 2.0 : Customization :

Problem: alphabetical order of links

Quote Reply
Problem: alphabetical order of links
Hi,

I'm using Links 2.0 (template-based), which is largely modified. I posted the question some month ago, but unfortunately I couldn't fix my problem:

I would like my links to appear in an alphabetical order. I think I must change something in sub build_sorthit. Here is the beginning of the Code from db_utils.pl:

sub build_sorthit {
# --------------------------------------------------------
# This function sorts a list of links. It has been modified to sort
# new links first, then cool links, then the rest alphabetically. By modifying
# the sort function below, you can sort the links however you like (by date,
# or random, etc.).
#
my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
# ***************************************** 3 Shestopalov modification - begin **************
my (%sortby, %priority, %isnew, %iscool, %isbest, $hit, $i, @sorted, $column, $type);
# ***************************************** 3 Shestopalov modification - end ****************

What must I exactly do so that my links are alphabetically ordered?

I'm appreciating your answers.

Phil.

Quote Reply
Re: Problem: alphabetical order of links In reply to
Links will display alphabetically by the title in your link.def file you will find
Code:
# Field number to sort links by:
$db_sort_links = 1;
You could change this to the URL if you wanted.

So as you can see it's set to 1 so all your links will display alphabeticaly from the Title Field


Regards

MDJ1
http://www.isee-multimedia.co.uk
Quote Reply
Re: Problem: alphabetical order of links In reply to
Thank you for your answer. In my links.def I have also set $db_sort_hits to 1, but my links aren't ordered alphabetically by title. What do you mean with:

>You could change this to the URL if you wanted.

Phil.

Quote Reply
Re: Problem: alphabetical order of links In reply to
Hi there,

What i meant by change it was that you could have links return your results in the order of any of the fields in the database.

If you have the value set to 1, the only links that will show up out of order are new and popular links. if you have this set. I have disabled this in my links site. I will see if I can find out how i did it and post back..


Regards

MDJ1
http://www.isee-multimedia.co.uk