Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

Alphabetizing links

Quote Reply
Alphabetizing links
How can I alphabetize the links listed in each category? Categories get listed alphabetically, but not the links.

Also, where can I set the links so that more than 10 appear on a page? I just want to show more links before the little "Next 10" link pops up.

Thanks
Quote Reply
Re: Alphabetizing links In reply to
These are better questions for the Modification Forum since you have already installed LINKS successfully in your server.

To alphabetize links in the categories....

Replace your sub build_sorthit routine in the db_utils.pl file with the following codes:

Code:
sub build_sorthit {
# --------------------------------------------------------
# Alphabetical sorting routine.

my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
my (%sortby, $hit, $i, @sorted);
for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
}
foreach $hit (sort {
return lc($sortby{$a}) cmp lc($sortby{$b});
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
return @sorted;

}

To put more links in your page, change the following variable setting in your links.cfg file:

Code:
$build_links_per_page = 10;

to the following:

Code:
$build_links_per_page = 20;

if you want to have 20 links per page.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Alphabetizing links In reply to
Thanks very much. I'll move over to the mod board now.
Quote Reply
Re: Alphabetizing links In reply to
Good...and you're welcome.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.