Gossamer Forum
Home : Products : DBMan : Installation :

How could I display on an html page...

Quote Reply
How could I display on an html page...
How could I display on an html page the current number of records in a database automatically?
Quote Reply
Re: How could I display on an html page... In reply to
Do you want this to appear within the pages created by DBMAN? Or do you want to have this appear on a static web page outside of DBMAN?

If it is the former, then you can the add the following sub-routine in your db.cgi file:

Code:
sub num_records {
# --------------------------------------------------------
# Displays the number of records

my $count = 0;

open (DB, "<$db_file_name") or &cgierr("error in num_records. unable to open database:
$db_file_name.\nReason: $!");
LINE: while (<DB> ) {
if (!(/^#/) && !(/^\s*$/)) {
$count++;
}
}
print $count;
}


Then in your html_records or html_home (basically any sub-routine that you want to post the total number of records), place the following codes:

Code:
HTML CODES
|; &num_records; print qq|
HTML CODES

If it's the latter, it could possibly be done through SSI (Server Side Includes) codes.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: How could I display on an html page... In reply to
If anyone knows how to get the totals from specific fields to appear on static pages outside of DBMan I would like to know about it.
Quote Reply
Re: How could I display on an html page... In reply to
Don and Dave, Eliot is right. In order to have any counts printed on a static html page, you would have to write a separate script and use an SSI.


------------------
JPD





Quote Reply
Re: How could I display on an html page... In reply to
Yes I want to display it on a static html page outside of the pages generated by dbman. Does anybody know of an SSI routine that could accomplish this?
Quote Reply
Re: How could I display on an html page... In reply to
Hmm, well for SSI all that you need to do is create another sub that prints out a page exactly like you want it to look, and then call the page via an SSI include using the default user.