I'm trying to compile a working version of the Related Links mod posted in other topics. Here is what I have so far, but it is not working. Any ideas?
1.) In links.def I added:
Related => [23, 'alpha', 40, 500, 0, '', ''],
2. I changed nph-build.cgi to this:
sub build_detailed_view {
# --------------------------------------------------------
# This routine build a single page for every link.
#
my (@values, $id, %rec, $related, $count);
if ($build_detail_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}
print "\t";
$related = "";
@rel = split(/~/, $rec{'related'});
foreach $related_link (@rel) {
my (%rel) = &get_record ($related_link);
$related .= &site_html_related_link (%rel);
}
open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name. Reason: $!");
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$id = $values[$db_key_pos];
%rec = &array_to_hash (0, @values);
$title_linked = &build_linked_title ("$rec{'Category'}/$rec{'Title'}");
open (DETAIL, ">$build_detail_path/$id$build_extension") or &cgierr ("Unable to build detail page: $build_detail_path/$id$build_extension. Reason: $!");
print DETAIL &site_html_detailed (%rec, $related);
close DETAIL;
$use_html ?
print qq~<a href="$build_detail_url/$id$build_extension" target="_blank">$id</a> ~ :
print qq~$id ~;
(++$count % 10) or print "\n\t";
}
close DB;
print "\n";
}
3. In site_html_templates.html:
sub site_html_detailed {
# --------------------------------------------------------
# This routine will build a single page per link. It's only
# really useful if you have a long review for each link --
# or more information then can be displayed in a summary.
#
my %rec = @_;
return &load_template ('detailed.html', {
description => $description,
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
total => $total,
title_linked => $title_linked,
rate_img => &get_rating_image($rec{'Rating'}),
related => $related, # This will created related links Added April 18th, 2001
%rec,
%globals
} );
}
sub site_html_related_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.
my %rel = @_;
# Set new and pop to either 1 or 0 for templates.
($rel{'isNew'} eq 'Yes') ? ($rel{'isNew'} = 1) : (delete $rel{'isNew'});
($rel{'isPopular'} eq 'Yes') ? ($rel{'isPopular'} = 1) : (delete $rel{'isPopular'});
return &load_template ('link_related.html',
{ detailed_url => "$db_detailed_url/$rel{'ID'}$build_extension",
title => $title,
%rel,
%globals
});}
4. I added a templated called link_related.html:
<ul><li><%Title%></li></ul>
Am I missing anything because I still get nothing when I add <%related%> or <%Related%> to the detailed page.
1.) In links.def I added:
Related => [23, 'alpha', 40, 500, 0, '', ''],
2. I changed nph-build.cgi to this:
sub build_detailed_view {
# --------------------------------------------------------
# This routine build a single page for every link.
#
my (@values, $id, %rec, $related, $count);
if ($build_detail_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}
print "\t";
$related = "";
@rel = split(/~/, $rec{'related'});
foreach $related_link (@rel) {
my (%rel) = &get_record ($related_link);
$related .= &site_html_related_link (%rel);
}
open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name. Reason: $!");
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$id = $values[$db_key_pos];
%rec = &array_to_hash (0, @values);
$title_linked = &build_linked_title ("$rec{'Category'}/$rec{'Title'}");
open (DETAIL, ">$build_detail_path/$id$build_extension") or &cgierr ("Unable to build detail page: $build_detail_path/$id$build_extension. Reason: $!");
print DETAIL &site_html_detailed (%rec, $related);
close DETAIL;
$use_html ?
print qq~<a href="$build_detail_url/$id$build_extension" target="_blank">$id</a> ~ :
print qq~$id ~;
(++$count % 10) or print "\n\t";
}
close DB;
print "\n";
}
3. In site_html_templates.html:
sub site_html_detailed {
# --------------------------------------------------------
# This routine will build a single page per link. It's only
# really useful if you have a long review for each link --
# or more information then can be displayed in a summary.
#
my %rec = @_;
return &load_template ('detailed.html', {
description => $description,
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
total => $total,
title_linked => $title_linked,
rate_img => &get_rating_image($rec{'Rating'}),
related => $related, # This will created related links Added April 18th, 2001
%rec,
%globals
} );
}
sub site_html_related_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.
my %rel = @_;
# Set new and pop to either 1 or 0 for templates.
($rel{'isNew'} eq 'Yes') ? ($rel{'isNew'} = 1) : (delete $rel{'isNew'});
($rel{'isPopular'} eq 'Yes') ? ($rel{'isPopular'} = 1) : (delete $rel{'isPopular'});
return &load_template ('link_related.html',
{ detailed_url => "$db_detailed_url/$rel{'ID'}$build_extension",
title => $title,
%rel,
%globals
});}
4. I added a templated called link_related.html:
<ul><li><%Title%></li></ul>
Am I missing anything because I still get nothing when I add <%related%> or <%Related%> to the detailed page.