Gossamer Forum
Home : Products : Links 2.0 : Customization :

Sorting COOL page...

Quote Reply
Sorting COOL page...
Hi!

Been seeking a solution on how to sort the WHATS COOL page with no luck...

Can any1 point me to the right search terms/past thread discussing this?

Some1 said he was able to find it but I can't.

What I need is to sort the WHAT'S COOL page based on number of hits instead of category...

I do have the span pages mod for the what's cool page applied so i hope it won't interefere with it.

Thanks!

Quote Reply
Re: [webcamworld] Sorting COOL page... In reply to
Read this thread: http://www.gossamer-threads.com/...forum.cgi?post=32792 (September 1999), it works fine on my site, seehttp://www.iyengar-yoga.com/Popular/.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Sorting COOL page... In reply to
Not the best example since you can't see "hits" for each of the links...you could be sorting by many different fields or combination of fields in that popular page example.

Sorry...not the best visual example to say the least.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [AnthroRules] Sorting COOL page... In reply to
Yeah, you're right I don't display the number of visits (why should people want to know that anyway?), but believe me, it's sorted by the number of visits....

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [webcamworld] Sorting COOL page... In reply to
Check the thread Yogi pointed out, it works fine. I also use it in combo with the AV span page mod: http://www.japanreference.com/cool/
Quote Reply
Re: [Tho.mas] Sorting COOL page... In reply to
Hi!

It looks like that was what I was looking for, I will test it inmediately.

Now, can you guys point me out (specially you, Thomas ;) ) how can I add the FOUND IN CATEGORY line, as in the thread it remains unsolved?


Thanks!!

Quote Reply
Re: [webcamworld] Sorting COOL page... In reply to
I don't have the thread at hand now, but search this forum for printcat.
Quote Reply
Re: [Tho.mas] Sorting COOL page... In reply to
Ok, will do.

Also, It looks like the span cool page mod is interferring the links display, as I applied what I think it's the correct placement for the new code but no links are displayed at all.

Please note the commented and uncommented stuff:

Code:
sub build_cool_page {
# --------------------------------------------------------
# Creates spanned "What's Cool" pages.
local ($total, $hits, $percent, $link_results, $title_linked, $title, $next, $prev);
my (%link_output, $category_clean, $url, $page_num, $prev_page, $next_page, $numlinks);

if ($build_cool_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}

$total = 0;
$numlinks = 0;

CATEGORY: foreach $category (sort keys %cool_links) {
LINK: for ($i = 0; $i < ($#{$cool_links{$category}}+1) / ($#db_cols + 1); $i++) {
$total++;
}
}

$numlinks = $total;
$title_linked = &build_linked_title ("Cool");
open (COOL, ">$build_cool_path/$build_index") or cgierr ("unable to open what's cool page: $build_cool_path/$build_index. Reason: $!");
print "\tCool Links: $total\n";
($db_popular_cutoff < 1) ?
($percent = $db_popular_cutoff * 100 . "%") :
($percent = $db_popular_cutoff);
close COOL;
$url = $build_cool_url;
$next = $prev = $link_results = "";
if (($numlinks > $build_links_per_page) && $build_span_pages) {
$total_pages=(int($numlinks/$build_links_per_page));
if ($total_pages < $numlinks/$build_links_per_page) {$total_pages++}
$next .= "<b>1</b>"; # new added
for $j(2..($total_pages)){
$next .= qq~ <a href="more$j$build_extension">$j</a>~;
} # end of for #added
$page_num = 2;
$next .= qq~ <a href="more$page_num$build_extension">[Next >>]</a>~;
$p = 1;
$t = 0;
$i = 0;
$r = 0;
# foreach $category (sort keys %cool_links) {
foreach $hit (sort {$b <=> $a} keys %cool_links) {
$category_clean = &build_clean ($category);
if ($i < $build_links_per_page) {
LINK: for ($q = 0; $q < ($#{$cool_links{$category}}+1) / ($#db_cols + 1); $q++) {
if ($i < $build_links_per_page) {
%tmp = &array_to_hash ($q, @{$cool_links{$category}});
$link_output{$category} .= &site_html_link (%tmp) . "\n";
$i++; }
else {
$r--;
$t = $q;
last; }
}
# $link_results .= qq|<P><A HREF="$build_root_url/$category/$build_index">$category_clean</A>\n|;
# $link_results .= $link_output{$category};
$link_results .= $link_output{$hit};
$r++;
}

}
$p++;
$numlinks = $numlinks - $i;
}

Can u help?

Thanks!

(working test version at http://webcamworld.com/directory/)

Thanks!

Quote Reply
Re: [webcamworld] Sorting COOL page... In reply to
The Span Page Mod should not have any effect on your links output.

Check out my build_cool sub (but mind I am using a template called searchlink.html in order to display links).
Quote Reply
Re: [Tho.mas] Sorting COOL page... In reply to
Thomas,

I think it works fine now... I was using $hit instead of $hits, and I needed to update $hits instead of $category almost EVERYWHERE, not just the output lines.

Thanks again.

I'm now trying to seek how to display the "Found in category" line, but I'm afraid I'll need a third template to build the links view only in the cool pages, am I right?



Quote Reply
Re: [webcamworld] Sorting COOL page... In reply to
You are correct. I am also using 3 or 4 different templates for link display. Wink
Quote Reply
Re: [Tho.mas] Sorting COOL page... In reply to
Thanks Thomas, u rool! ;)