Okay...I figured out how to get the following calculations:
1)
Total Hits 2)
Most Hits 3)
Least Hits that can be posted in the
Home Page. (Thanks to Widgetz's
sub get_reviews routine codes.)
This is NOT an easy code hack to implement...please save a copy of the following files before hacking:
1)
nph-build.cgi 2)
site_html_templates.pl Okay...here we go...Ready?
(1) Add the following codes in the
sub build_stats routine in the
nph-build.cgi file:
Code:
$grandhits{$values[$db_hits]}++;
$hitstotal += $values[$db_hits];
$grandhits++;
if ($lowest > $values[$db_hits]) {
$lowest = $values[$db_hits];
}
else {
$lowest = "0";
}
if ($highest < $values[$db_hits]) {
$highest = $values[$db_hits];
}
else {
$highest = "Not Calculated";
} AFTER the following codes:
Code:
$category = $values[$db_category]; (2) Then replace the following codes in the
sub build_home_page routine:
with the following codes:
Code:
local ($total, $totalhits, $lowhits, $highhits); (3) Then add the following codes in the same sub-routine:
Code:
print "\tTotal Hits: $hitstotal\n";
print "\tMost Hits: $highest\n";
print "\tLeast Hits: $lowest\n"; AFTER the following codes:
Code:
print "\tTotal Links: $grand_total\n"; (4) Then add the following codes in the same sub-routine:
Code:
$totalhits = $hitstotal;
$lowhits = $lowest;
$highhits = $highest; AFTER the following codes:
Code:
$total = $grand_total; (5) Then add the following tag definitions in the
sub site_html_home routine in the
site_html_templates.pl file:
Code:
totalhits => $totalhits,
lowhits => $lowest,
highhits => $highest (6) Then add the following tags in your
home.html file:
Code:
<%totalhits%>
<%lowhits%>
<%highhits%> That should do it....
BTW: I have this working in my Anthropology portal site:
http://vlib.anthrotech.com Regards,
Eliot Lee