Gossamer Forum
Home : Products : Links 2.0 : Customization :

Span Pages for New, Cool, Top pages

(Page 1 of 2)
> >
Quote Reply
Span Pages for New, Cool, Top pages
Let's say you added 50 new links in one day. The "New" page would then contain 50 links. Same thing with the Cool and TopRated pages. How can split those pages into 10 or 20 links per page just like the normal links pages?
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
I just found this thread:

http://www.gossamer-threads.com/...um3/HTML/001260.html

I think it is addressing the same problem. Unfortunately, the problem was not resolved.
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
t_dog,

Did you see Lorance's new thread on span mod? http://www.gossamer-threads.com/...um3/HTML/002214.html Maybe there's something in his new routine you could use.
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
Well, I'm no programmer. Smile
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
Basically, I don't even need the New, Cool, etc. pages to span like Altavista. I would be very happy if it can just be split into multiple pages with the link "Next 10" and "Prev 10" at the bottom.

Anyone have any suggestions?
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
you know.. i hate it when i read threads like this.. cause i am trying to make my review mod.. and i just want to stop and do this mod.. Smile but it will delay my review mod..

grr

oh well.. i will do this mod Smile

i'll try it with the "new" pages first.. check back tommorrow Smile

Jerry
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
 
Quote:
you know.. i hate it when i read threads like this.. cause i am trying to make my review mod.. and i just want to stop and do this mod.. but it will delay my review mod..

I'm sorry I distracted you. Smile I'm really looking forward to your review mod. This small problem can wait.
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
well.. i seem to have it so far.. i am now able to cut it at the build_links_per_page and receive the variable for the following pages..

but now i need to figure out how to make the next pages..

BTW.. is this date format ok for following pages?

11-Jul-1999-2.html
11-Jul-1999-3.html

or do you prefer something else?

thanks!
jerry
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
So you decided to work on this problem? Wink

Quote:
BTW.. is this date format ok for following pages?

11-Jul-1999-2.html
11-Jul-1999-3.html

or do you prefer something else?

That's absolutely fine.

Would you be able to come up with generic instructions so I can modify the New pages, Cool pages, Top Rated pages, and the Editor's Picks pages?

Thanks.
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
since when were there editor picks? Smile

i don't have that mod! Smile
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
widgetz-
I don't think it ever got added to the resource list--it was done prior to Alex putting the resource center up. Complete instructions are in this thread:
www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/000903.html

Its a good mod. It's much like the "cool" page, except you get to decide whether you want the link to be a pick or not without any interaction from hits or votes...I use it to mark winners of my site award. I'd definitely like it to span pages though--my attempts were pathetically ineffective. If you have any brilliant ideas I'd be grateful Wink
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
OK YOU GUYS! you will have to wait a little on this one.. it is giving me the worst headache.. lol.. it is so much easier with the category pages cause you only have 1 category to deal with.. Smile

i'll keep trying.. in this triple digit heat i sweat when i type Smile

lol.. k.. bye.. hope to finish this soon..
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
do you guys really need it to post the categories? Smile

cause that is the only thing that doesn't work.. i plan on not using it cause my links are in multiple categories..

hehe

reply soon..
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
I would hate it if you lose sleep over this, Smile but I, personally, think that displaying the category with the link is kind of nice. Furthermore, if this mod were to be applied to the Editor's Picks or Top Rated pages, it wouldn't make much sense without the categories.

What do you guys think?
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
oh.. my fan was getting really hot that it smelled like something burning.. so i turned it off... i wished i had air conditioning!!!!!! AHH Smile

anyways.. i got it working with the categories.. but only on the first page.. LOL

Smile

almost there i guess...
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
you know.. i think i am going to do it the "EASY" way.. lol Smile

what i am going to do since i got the first page already is ..

rest pages.. skip $build_links_per_page amount of links and print the rest.. lol Smile

it will definately make it slower.. but i hope someone like bobsie will look at it and see what he can do to shorten it..
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
Has anyone been able to span the What's New or What's Cool pages yet? I searched but didn't find any recent interest in this topic. I'm mainly interested in spanning the What's Cool page.

I looked at the spanning section in nph-build but I haven't a clue which variables to change (after being copied to the build "cool" section) in order to make that work.

Suggestions or new ideas?

Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
We are also interested in spanning the What's Cool page, so we are hoping that somebody will come up with a solution.

------------------
HumorLinks Comedy Search, Humor DVD and Video Store

humorlinks.com

humorlinks@humorlinks.com
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
Hello!

Has anybody been able to figure out the solution to this problem? I am also trying to span the top rated pages...Please send me a message is you think you could help...

Much thanks in advance!

Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
Not being able to span the "What's Cool" page seems to be a design fault in Links 2.0

Have I just committed blasphemy?

Imagine a site with 2000+ links either being restricted to just 20 or so "cool" links - or alternatively having a monster "What's Cool" page with 100+ listings.

I am still trying to write a mod for this. So far I can produce the correct pages but with just one (the same top cool) link on each page - which is not very helpful. Also the first page has no [<< Prev] or [Next >>] buttons on it. So I haven't done very well (yet).

Has anybody made better progress?

If so, please help us!

Warwick.

------------------
HumorLinks Comedy Search, Humor DVD and Video Store

humorlinks.com

humorlinks@humorlinks.com
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
I have made some progress in terms of organizing my Site Review pages into a menu page by date.

I am playing around with spanning pages for other sections of my site...when I have a solution I will create a FAQ/Tutorial/Code Hack for it.

Regards,

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


Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
Success! I have managed to span the "What's Cool" page, listing links in order of popularity. It's working, and you can see it at: -

http://www.humorlinks.com/links/Cool/

The mod is as follows: -

In nph-build.cgi, look for the sub build_stats. As you look through it, you will see: -

Code:
$category = $values[$db_category];


Right under, put in the following: -

Code:
$hits = $values[$db_hits];


Now, as you look further down the sub, you will see: -

Code:
push (@{$cool_links{$category}}, @values) if ($values[$db_ispop] eq "Yes");


replace this with the following: -

Code:
push (@{$cool_links{$hits}}, @values) if ($values[$db_ispop] eq "Yes");


Then (also in nph-build.cgi) change sub build_cool_page to the following: -

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 $hits (sort keys %cool_links) {
LINK: for ($i = 0; $i < ($#{$cool_links{$hits}}+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 $hits (sort {$b <=> $a} keys %cool_links) {
$category_clean = &build_clean ($category);
if ($i < $build_links_per_page) {
LINK: for ($q = 0; $q < ($#{$cool_links{$hits}}+1) / ($#db_cols + 1); $q++) {
if ($i < $build_links_per_page) {
%tmp = &array_to_hash ($q, @{$cool_links{$hits}});
$link_output{$hits} .= &site_html_link (%tmp) . "\n";
$i++;
}
else {
$r--;
$t = $q;
last; }
}
$link_results .= $link_output{$hits};
$r++;
}

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

# Otherwise we either only have less then x number of links, or we are not
# splitting pages, so let's just build them all.

else {
foreach $hits (sort {$b <=> $a} keys %cool_links) {
$category_clean = &build_clean ($category);
LINK: for ($q = 0; $q < ($#{$cool_links{$hits}}+1) / ($#db_cols + 1); $q++) {
%tmp = &array_to_hash ($q, @{$cool_links{$hits}});
$link_output{$hits} .= &site_html_link (%tmp) . "\n";
}

$link_results .= $link_output{$hits};
}
}

# Create the main page.
open (COOL, ">$build_cool_path/$build_index") or &cgierr ("unable to open what's cool page: $build_cool_path/$build_index. Reason: $!");
print COOL &site_html_cool(@cool_links);
close COOL;

# Then we go through the list of links and build on the remaining pages.
while ($next && $build_span_pages) {
if ($numlinks > $build_links_per_page) {
$prev=$next=$next_page=$prev_page="";
$next_page = $page_num+1;
$prev_page = $page_num-1;
if ($page_num == 2){
$prev .= qq~ <a href="$url">[<< Prev]</a> ~;
$prev .= qq~ <a href="$url"> 1</a> ~;}
else {$prev .= qq~ <a href="more$prev_page$build_extension">[<< Prev]</a> ~;
$prev .= qq~ <a href="$url">1</a> ~;
for $k(2..$prev_page){$prev .= qq~ <a href="more$k$build_extension">$k</a>~;}}
$next .= qq~ <b>$page_num</b> ~;
for $m($next_page..$total_pages){$next .= qq~ <a href="more$m$build_extension">$m</a>~;}
$next .= qq~ <a href="more$next_page$build_extension">[Next >>]</a>~;
} # end of if
else {
if ($page_num == $total_pages) {
$prev = $next = $next_page = $prev_page= "";
$prev_page=$total_pages-1;
if ($page_num == 2){
$prev .= qq~ <a href="$url">[<< Prev]</a> ~;
$prev .= qq~ <a href="$url"> 1</a> ~;}
else {$prev .= qq~ <a href="more$prev_page$build_extension">[<< Prev]</a> ~;
$prev .= qq~ <a href="$url">1</a> ~;
for $k(2..$prev_page){$prev .= qq~ <a href="more$k$build_extension">$k</a>~;}
} # end of else
$prev .= qq~ <b>$page_num</b> ~;
} # end of if
} # end of else
$link_results = "";
$i = 0;
$s = 1;
foreach $hits (sort {$b <=> $a} keys %cool_links) {
if (($s > $r) && ($i < $build_links_per_page)) {
$category_clean = &build_clean ($category);
$link_output{$hits} = "";
LINK: for ($q = $t; $q < ($#{$cool_links{$hits}}+1) / ($#db_cols + 1); $q++) {
if ($i < $build_links_per_page) {
%tmp = &array_to_hash ($q, @{$cool_links{$hits}});
$link_output{$hits} .= &site_html_link (%tmp) . "\n";
$i++;
$t = 0;

}
else {
$r--;
$t = $q;
last; }


}


$link_results .= $link_output{$hits};
$r++;
}
$s++;
}
$title_linked = &build_linked_title ("$cat/Page_$page_num/");
$title = &build_unlinked_title ("$cat/Page_$page_num/");
$use_html ?
print qq|\tSubpage : <A HREF="|, $url, qq|more$page_num$build_extension" TARGET="_blank">$build_cool_path/more$page_num$build_extension</A>\n| :
print qq|\tSubpage : $build_cool_path/more$page_num$build_extension\n|;

open (COOL, ">$build_cool_path/more$page_num$build_extension") or &cgierr ("unable to open what's cool page: $build_cool_path/index$page_num$build_extension. Reason: $!");
print COOL &site_html_cool(@cool_links);
close COOL;
$p++;
$numlinks = $numlinks - $i;
if ($page_num == $total_pages) { last; }
else { $page_num++; }
}
print "\n";
}


Then add the "prev => $prev" and "next => $next" lines to site_html_templates.pl under sub site_html_cool like this: -

Code:
sub site_html_cool {
# --------------------------------------------------------
# This routine will build a what's cool page.

return &load_template ('cool.html', {
total => $total,
grand_total => $grand_total,
percent => $percent,
prev => $prev,
next => $next,
link_results => $link_results,
title_linked => $title_linked,
%globals
} );
}


and finally add the tags to the cool.html template above and below the link results like this: -

Code:
<center>
<%if prev%>
<%prev%>
<%endif%>

<%if next%>
<%next%>
<%endif%>
</center>

<%link_results%>

<center>
<%if prev%>
<%prev%>
<%endif%>

<%if next%>
<%next%>
<%endif%>
</center>


This mod lists cool sites in order of popularity, rather than category.

For a version of this mod to span the cool sites page and keep them in categories,
see the post lower down in this thread.

Warwick.

------------------
HumorLinks Comedy Search, Humor DVD and Video Store

http://www.humorlinks.com

humorlinks@humorlinks.com
Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
That mod was long overdue, thanks a lot!! Hope you'll be equally successful with new.html... Smile

------------------
Thomas
japanreference.com

Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
Good job...Make sure that you add the Modification to the Resource Center.

Regards,

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


Quote Reply
Re: Span Pages for New, Cool, Top pages In reply to
I have made some slight changes to the mod, and have edited my previous post accordingly.

The pages were not always building evenly and the links were not listed in a meaningful manner.

Both these errors have now been corrected.

Warwick.



------------------
HumorLinks Comedy Search, Humor DVD and Video Store

humorlinks.com

humorlinks@humorlinks.com
> >