Thanks! But sorry, I get an error. I give you the scripts, where I put the changes, maybe you know, what I've done wrong:
in the ngh-build.cgi:
sub build_category_pages {
# --------------------------------------------------------
# This routine builds all the category pages. Each category uses
# the same template which is defined in &site_html_category.
#
my ($s, $e, $f, $limit, $offset, $get_related, $subcat_info, $get_links, $get_alt);
print "Building category pages ... \n\n";
$s = time();
$limit = &Links::DB_Utils::get_totalcats; $offset = 0;
$subcat_info = $CATDB->prepare ( qq!
SELECT Category.*
FROM Category, CategoryHierarchy
WHERE CategoryHierarchy.CategoryID = ? AND
CategoryHierarchy.Depth = 1 AND
CategoryHierarchy.SubCategoryID = Category.ID
!) or die "Can't prepare: $DBI::errstr";
$get_related = $LINKDB->prepare (" SELECT Category.Name FROM CategoryRelations, Category WHERE CategoryRelations.CategoryID = ? AND CategoryRelations.RelatedID = Category.ID");
$get_links = $LINKDB->prepare (" SELECT * FROM Links WHERE CategoryID = ? ORDER BY $LINKS{build_sort_order_category} LIMIT 1000 ");
$get_alt = $LINKDB->prepare (" SELECT l.* FROM Links as l, CategoryAlternates as c WHERE l.ID = c.LinkID AND c.CategoryID = ? ORDER BY $LINKS{build_sort_order_category} LIMIT 1000 ");
my ($categories_r, $links_r, $category_r, $subcategory_r, $alt_r, $total_links);
my ($directory, $url, $numlinks, $page_num, $tmp, $name, %OUT);
###while (1) {
$categories_r = $CATDB->query ( { ID => '*', mh => $limit, nh => $offset+1, sb => 'Name', so => 'ASC', tb => 0 });
###last unless ($categories_r and @{$categories_r} > 0);
foreach $category_r (@{$categories_r}) {
in the DB_Utils.pm:
sub get_totalcats {
#-----------------------------------------------------
my ($CATDB, $GRAND_TOTAL);
$GRAND_TOTAL = 0;
$CATDB = new Links::DBSQL "$LINKS{admin_root_path}/defs/Category.def";
$GRAND_TOTAL = $CATDB->total();
return $GRAND_TOTAL;
}
sub cgi_to_hash {
# --------------------------------------------------------
# Converts a CGI object to a hash ref.
#
my $in = shift;
my %rec = ();
foreach ($in->param) { $rec{$_} = join "\0", $in->param($_); }
return \%rec;
}
and in the HTML_Template:
# You can put variables here that you would like to use in any
# of your templates.
%GLOBALS = (
date => \&Links::DBSQL::get_date,
time => \&Links::DBSQL::get_time,
db_cgi_url => $LINKS{db_cgi_url},
build_root_url => $LINKS{build_root_url},
site_title => $LINKS{build_site_title},
css => $LINKS{build_css_url},
totalcats => &Links::DB_Utils::get_totalcats,
banner => ''
);
in the ngh-build.cgi:
sub build_category_pages {
# --------------------------------------------------------
# This routine builds all the category pages. Each category uses
# the same template which is defined in &site_html_category.
#
my ($s, $e, $f, $limit, $offset, $get_related, $subcat_info, $get_links, $get_alt);
print "Building category pages ... \n\n";
$s = time();
$limit = &Links::DB_Utils::get_totalcats; $offset = 0;
$subcat_info = $CATDB->prepare ( qq!
SELECT Category.*
FROM Category, CategoryHierarchy
WHERE CategoryHierarchy.CategoryID = ? AND
CategoryHierarchy.Depth = 1 AND
CategoryHierarchy.SubCategoryID = Category.ID
!) or die "Can't prepare: $DBI::errstr";
$get_related = $LINKDB->prepare (" SELECT Category.Name FROM CategoryRelations, Category WHERE CategoryRelations.CategoryID = ? AND CategoryRelations.RelatedID = Category.ID");
$get_links = $LINKDB->prepare (" SELECT * FROM Links WHERE CategoryID = ? ORDER BY $LINKS{build_sort_order_category} LIMIT 1000 ");
$get_alt = $LINKDB->prepare (" SELECT l.* FROM Links as l, CategoryAlternates as c WHERE l.ID = c.LinkID AND c.CategoryID = ? ORDER BY $LINKS{build_sort_order_category} LIMIT 1000 ");
my ($categories_r, $links_r, $category_r, $subcategory_r, $alt_r, $total_links);
my ($directory, $url, $numlinks, $page_num, $tmp, $name, %OUT);
###while (1) {
$categories_r = $CATDB->query ( { ID => '*', mh => $limit, nh => $offset+1, sb => 'Name', so => 'ASC', tb => 0 });
###last unless ($categories_r and @{$categories_r} > 0);
foreach $category_r (@{$categories_r}) {
in the DB_Utils.pm:
sub get_totalcats {
#-----------------------------------------------------
my ($CATDB, $GRAND_TOTAL);
$GRAND_TOTAL = 0;
$CATDB = new Links::DBSQL "$LINKS{admin_root_path}/defs/Category.def";
$GRAND_TOTAL = $CATDB->total();
return $GRAND_TOTAL;
}
sub cgi_to_hash {
# --------------------------------------------------------
# Converts a CGI object to a hash ref.
#
my $in = shift;
my %rec = ();
foreach ($in->param) { $rec{$_} = join "\0", $in->param($_); }
return \%rec;
}
and in the HTML_Template:
# You can put variables here that you would like to use in any
# of your templates.
%GLOBALS = (
date => \&Links::DBSQL::get_date,
time => \&Links::DBSQL::get_time,
db_cgi_url => $LINKS{db_cgi_url},
build_root_url => $LINKS{build_root_url},
site_title => $LINKS{build_site_title},
css => $LINKS{build_css_url},
totalcats => &Links::DB_Utils::get_totalcats,
banner => ''
);