Gossamer Forum
Home : Products : Links 2.0 : Customization :

NEW page as Historic

Quote Reply
NEW page as Historic
It seems that the 'New' page shows only the links recent addings considered as new (which is logical Sly).

But is there a way to have in this page ALL the links addings ordered by date, like an historic of all the links addings even if these addings are old.

Moreover, it would still be fine to keep the logo 'New' beside the more recent dates.

Tanx if you can help.
Quote Reply
Re: [jigme] NEW page as Historic In reply to
alternatively, you could use something like Paul's topx at http://www.gossamer-threads.com/..._string=topx;#168184

Links does things in stages. For your purposes the sub build_update_newpop is run which opens the links file and reads each record and assigns it a Yes (for new ) or a No ( for not new ). Then the build stats routine coems along a bit later and opens the link file and builds a globally accessable array of new links. Then a bit later the build_new_page routine comes along and uses that new links array to buld the new page.

While I'm no perlie, maybe you could do something like the following in the nph-build.cgi file

use vars qw(%category %subcategories @links @new_links @old_links @cool_links %stats $grand_total $use_html $nph $date $time);


in sub build_stats

Code:
# Add the link to the list of new links if it is new.
push (@{$new_links{$category}}, @values) if ($values[$db_isnew] eq "Yes");
push (@{$old_links{$category}}, @values) if ($values[$db_isnew] eq "No");
(NOTE: you can change the format of the IF statement to streamline it.
I leave that for the experts)


That should put all the links in two arrays. You are on you own at this point but what I would try to do is:

in sub build_new_page

copy the section that begin with

Code:
# Now we go through all the new_links (which are organized by category), and
# build the html in array indexed by date then category.
# $total = 0;
CATEGORY: foreach $category (sort keys %old_links) {
LINK: for ($i = 0; $i < ($#{$old_links{$category}}+1) / ($#db_cols + 1); $i++) {
$total++;
%tmp = &array_to_hash ($i, @{$old_links{$category}});
${$link_output{$tmp{'Date'}}}{$category} .= &site_html_link (%tmp) . "\n";
$span_totals{$tmp{'Date'}}++;
}
}


this is the part I am not sure about. I would start with the above and place it right after the same section that does the new_links and before the sections that starts with

# Then we go through each date, and build the links for that date. If we are spanning

I'm not sure if that would be right or not. Maybe, you would have to do the two "new" sections and then do the same two sections using the old links.

But this may be a start. I cannot test it so you will have to do a trial by error...


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [jigme] NEW page as Historic In reply to
I just tested my suggestion and it does work as presented: prints all the dates with the links for that date.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] NEW page as Historic In reply to
CONGRATULATIONS !!!Wink

It works very fine.Sly

THANK YOU very much.Smile