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

Cool Page Sort Order

Quote Reply
Cool Page Sort Order
I finally figured out how to do what I wanted, and it's actually pretty easy.

If you've tried to change the way the Cool page sorts links, you've probably hit a bit of frustration at the super-imposed 'by category' sort.

In the nph-build.cgi in the build_cool_page sub, make the following changes after the SQL query:

Code:
# Create the HTML for the individual links.
$total = 0;
while ($link = $sth->fetchrow_hashref) {
$total++;

## $link_output{$link->{'Name'}} .= &site_html_link ($link); ## this is used to group the links by category, uncomment the following block/loop of code to use

## use the following line (instead of the subsequent 2) for the category name in "plain" format
## $link_results .= &build_clean_name ($link->{'Name'});
my $category_clean .= &build_clean_name ($link->{'Name'}); # needed to allow variable replacement in the next line
$link_results .= qq|<P><B>Cool Link \#$total was found in : </B><BR> <A HREF="$LINKS{build_root_url}/$category_clean/$LINKS{build_index}">$link->{'Name'}</A></p>\n|;
$link_results .= &site_html_link ($link);
}

## Uncomment to sort by category then other criteria, leave commented to sort only by the other criteria
# Create the HTML for the category headers, and join it all together into link_results.
## foreach $category (sort keys %link_output) {
## $category_clean = &build_clean_name ($category);
## $link_results .= qq|<P><A HREF="$LINKS{build_root_url}/$category_clean/$LINKS{build_index}">$category</A>\n|;
## $link_results .= $link_output{$category};
## }

I left most of the code in to allow you to easily change back, or make additional changes.

** To see what it looks like, check:
http://www.postcards.com/LinkSQL/pages/Cool/


[This message has been edited by pugdog (edited November 28, 1999).]