Ok this will show you how to build a list of editor's pick on a separate page sort of like the what's cool page. After you specify the link as an editor's pick it will build this page w/ the list of links. Remember to back up all files that you make changes to...so that if you fail in your attempt to make this modification you can easily go back to your normal ways.
ok here goes.
1. Add this to links.cfg
and replace it w/ this:
7. Find this section:
%subcategories = ();
@links = ();
@new_links = ();
@cool_links = ();
%stats = ();
$grand_total = 0;
my $t1 = time();
and replace it with this:
%subcategories = ();
@links = ();
@new_links = ();
@cool_links = ();
@pick_links = ();
%stats = ();
$grand_total = 0;
my $t1 = time();
8. Find the step 4 section of the staggered build and add this:
print "** Creating Editor's Picks Page. . .\n";
&build_pick_page;
print "** Done (", time - $t1, " s)!\n\n"; underneath
print "** Creating What's New Pages . . .\n";
&build_new_page;
print "** Done (", time - $t1, " s)!\n\n";
9. Go to this section:
# --------------------------------------------------------
# Rebuild the entire directory.
and add this:
$use_html ?
print "Building <A HREF=\"$build_pick_url/$build_index\">Editor's Pick</A> Page . . .\n" :
print "Building Editor's Pick Page . . .\n";
&build_pick_page;
print "Done\n\n";
preferably underneath:
$use_html ?
print "Building <A HREF=\"$build_new_url/$build_index\">What's New</A> Page . . .\n" :
print "Building What's New Page . . .\n";
&build_new_page;
print "Done\n\n";
10. Find sub build_stats {
add this:
push (@{$pick_links{$category}}, @values) if ($values[$db_ispick] eq "Yes");
preferably underneath:
push (@{$cool_links{$category}}, @values) if ($values[$db_ispop] eq "Yes");.
11. Find this sub: sub build_cool_page {
DIRECTLY ABOVE THAT add this:
# --------------------------------------------------------
# Creates a "Editor's Pick" page.
local ($total, $link_results, $title_linked);
my (%link_output, $category_clean);
if ($build_pick_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}
$total = 0;
CATEGORY: foreach $category (sort keys %pick_links) {
LINK: for ($i = 0; $i < ($#{$pick_links{$category}}+1) / ($#db_cols + 1); $i++) {
$total++;
%tmp = &array_to_hash ($i, @{$pick_links{$category}});
$link_output{$category} .= &site_html_link (%tmp) . "\n";
}
}
foreach $category (sort keys %pick_links) {
$category_clean = &build_clean ($category);
$link_results .= qq|<P><A HREF="$build_root_url/$category/$build_index">$category_clean</A>\n|;
$link_results .= $link_output{$category};
}
$title_linked = &build_linked_title ("Picks");
open (PICK, ">$build_pick_path/$build_index") or cgierr ("unable to open editor's picks page: $build_pick_path/$build_index. Reason: $!");
print "\tEditor's Picks: $total\n";
print PICK &site_html_pick(@pick_links);
close PICK;
}
12. This one is optional. If you want an editor's pick image or something to say it's editor's pick in that links listing. just add something like this in the link.html template.
<img src="/images/pick.gif" width="35" height="14" align="absmiddle" alt="Editor's Pick">
<%endif%>
13. Now you can add a link to your editor's pick page in your templates. add something similar to this: <A HREF="<%build_pick_url%>Editor's Picks</A>
That's all folks.
[This message has been edited by hellraida (edited March 13, 1999).]
[This message has been edited by hellraida (edited March 14, 1999).]
ok here goes.
1. Add this to links.cfg
Code:
use vars qw(%category %subcategories @links @new_links @cool_links %stats $grand_total $use_html $nph $date $time);Code:
use vars qw(%category %subcategories @links @new_links @cool_links @pick_links %stats $grand_total $use_html $nph $date $time);7. Find this section:
Code:
%category = (); %subcategories = ();
@links = ();
@new_links = ();
@cool_links = ();
%stats = ();
$grand_total = 0;
my $t1 = time();
and replace it with this:
Code:
%category = (); %subcategories = ();
@links = ();
@new_links = ();
@cool_links = ();
@pick_links = ();
%stats = ();
$grand_total = 0;
my $t1 = time();
8. Find the step 4 section of the staggered build and add this:
Code:
$t1 = time(); print "** Creating Editor's Picks Page. . .\n";
&build_pick_page;
print "** Done (", time - $t1, " s)!\n\n";
Code:
$t1 = time(); print "** Creating What's New Pages . . .\n";
&build_new_page;
print "** Done (", time - $t1, " s)!\n\n";
9. Go to this section:
Code:
sub build_all { # --------------------------------------------------------
# Rebuild the entire directory.
and add this:
Code:
# Create Editor's Pick Page $use_html ?
print "Building <A HREF=\"$build_pick_url/$build_index\">Editor's Pick</A> Page . . .\n" :
print "Building Editor's Pick Page . . .\n";
&build_pick_page;
print "Done\n\n";
preferably underneath:
Code:
# Create What's New Page $use_html ?
print "Building <A HREF=\"$build_new_url/$build_index\">What's New</A> Page . . .\n" :
print "Building What's New Page . . .\n";
&build_new_page;
print "Done\n\n";
10. Find sub build_stats {
add this:
Code:
# Add the link to the list of editor's pick links if it is pick. push (@{$pick_links{$category}}, @values) if ($values[$db_ispick] eq "Yes");
preferably underneath:
Code:
# Add the link to the list of cool links if it is popular. push (@{$cool_links{$category}}, @values) if ($values[$db_ispop] eq "Yes");
11. Find this sub: sub build_cool_page {
DIRECTLY ABOVE THAT add this:
Code:
sub build_pick_page { # --------------------------------------------------------
# Creates a "Editor's Pick" page.
local ($total, $link_results, $title_linked);
my (%link_output, $category_clean);
if ($build_pick_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}
$total = 0;
CATEGORY: foreach $category (sort keys %pick_links) {
LINK: for ($i = 0; $i < ($#{$pick_links{$category}}+1) / ($#db_cols + 1); $i++) {
$total++;
%tmp = &array_to_hash ($i, @{$pick_links{$category}});
$link_output{$category} .= &site_html_link (%tmp) . "\n";
}
}
foreach $category (sort keys %pick_links) {
$category_clean = &build_clean ($category);
$link_results .= qq|<P><A HREF="$build_root_url/$category/$build_index">$category_clean</A>\n|;
$link_results .= $link_output{$category};
}
$title_linked = &build_linked_title ("Picks");
open (PICK, ">$build_pick_path/$build_index") or cgierr ("unable to open editor's picks page: $build_pick_path/$build_index. Reason: $!");
print "\tEditor's Picks: $total\n";
print PICK &site_html_pick(@pick_links);
close PICK;
}
12. This one is optional. If you want an editor's pick image or something to say it's editor's pick in that links listing. just add something like this in the link.html template.
Quote:
<%if isPick%> <img src="/images/pick.gif" width="35" height="14" align="absmiddle" alt="Editor's Pick">
<%endif%>
13. Now you can add a link to your editor's pick page in your templates. add something similar to this: <A HREF="<%build_pick_url%>Editor's Picks</A>
That's all folks.
[This message has been edited by hellraida (edited March 13, 1999).]
[This message has been edited by hellraida (edited March 14, 1999).]