Would anyone know how to make <%grand_total%> as a global variable in HTML_Templates. I had it going but didn't work with add.cgi.
This is what I tried. It worked on every page except add.cgi,
I added this to the top of HTML_Templates.pm
my ($LINKDB,$sth,$total,$GRAND_TOTAL);
$LINKDB = new Links: BSQL "$LINKS{admin_root_path}/defs/Links.def";
$sth = $LINKDB->prepare ("SELECT COUNT(*) FROM CategoryAlternates");
$sth->execute();
($total) = $sth->fetchrow_array;
$GRAND_TOTAL = $LINKDB->total();
%GLOBALS = (
date => \&Links: BSQL::get_date,
time => \&Links: BSQL::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},
banner => '',
grand_total => $GRAND_TOTAL
);
Any ideas?
Thanks,
Kevin
This is what I tried. It worked on every page except add.cgi,
I added this to the top of HTML_Templates.pm
my ($LINKDB,$sth,$total,$GRAND_TOTAL);
$LINKDB = new Links: BSQL "$LINKS{admin_root_path}/defs/Links.def";
$sth = $LINKDB->prepare ("SELECT COUNT(*) FROM CategoryAlternates");
$sth->execute();
($total) = $sth->fetchrow_array;
$GRAND_TOTAL = $LINKDB->total();
%GLOBALS = (
date => \&Links: BSQL::get_date,
time => \&Links: BSQL::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},
banner => '',
grand_total => $GRAND_TOTAL
);
Any ideas?
Thanks,
Kevin