I would like to display total links number of the subdir, where the links was posted.
The reason why it seems difficult, it's because I want it to be displayed by the sub site_html_add_success. So it should be displayed after the form was posted successfully.
Link counting is done in nph_build.cgi, so I had to implement the link counting routine into site_html_templates.pl:
# --------------------------------------------------------
# It finds out how many links are in each category
my $category = $_;
my (@values, $cat, @alt_categories, @categorylist, $depth, $i, $cat);
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 ($_);
# Add the link to the list of links.
push (@{$links{$category}}, @values);
$grand_total++;
# Calculate the stats: the number of links and the newest link.
@categorylist = split (/\//, $category);
$depth = $#categorylist;
}
close DB;
return $depth;
}I call this sub in site_html_add_success like this:
Then associate the name:
I don't know why, but it's not working fine. I get -1 as total link number.
What can be the problem?
Thanks,
Webmaster33
[This message has been edited by webmaster33 (edited March 05, 2000).]
The reason why it seems difficult, it's because I want it to be displayed by the sub site_html_add_success. So it should be displayed after the form was posted successfully.
Link counting is done in nph_build.cgi, so I had to implement the link counting routine into site_html_templates.pl:
Code:
sub category_link_count { # --------------------------------------------------------
# It finds out how many links are in each category
my $category = $_;
my (@values, $cat, @alt_categories, @categorylist, $depth, $i, $cat);
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 ($_);
# Add the link to the list of links.
push (@{$links{$category}}, @values);
$grand_total++;
# Calculate the stats: the number of links and the newest link.
@categorylist = split (/\//, $category);
$depth = $#categorylist;
}
close DB;
return $depth;
}
Code:
$total = &category_link_count ($category);Code:
total => $total,What can be the problem?
Thanks,
Webmaster33
[This message has been edited by webmaster33 (edited March 05, 2000).]