Gossamer Forum
Home : Products : DBMan : Customization :

SSI or Include in sub html_home

Quote Reply
SSI or Include in sub html_home
Been all over the forum and Lois' FAQ, trying to find out how to show the # of records in my database in sub html_home.

I've tried the
Code:
!--#exec cmd="/path/to/recount.cgi" --
Code:
!--#exec cgi="/path/to/recount.cgi" --
and
Code:
!--#include virtual="/path/to/recount.cgi" --
ways, coupled with the
Code:
sub include_file {
#------------------------------------------------
open(FILE, "/path/to/recount.cgi") or die("Couldn't open the file.");
@lines = <FILE>;
close(FILE);
foreach $line (@lines) {
print $line;
}
}
in both my db.cgi and html.pl, with ref to &include_file; (even print &include;) where I want it printed.

My recount.cgi executes correctly from the browser, so that's fine. My current setup is the sub include_file ref'd above with
Code:
|;
&include_file;
print qq|
in my sub html_home, but that gives me
Code:
#!/usr/local/bin/perl #print "Content-type: text/html\n\n";
open (DB, "/www43/web/izmirh/cgi-local/Databasetest/default.db") or print "Cant' find db!";
while ( ) { $count++; } close DB;
print $count; 1;
as the output, :-0.

Nothing seems to work -- I'm out of ideas. Any suggestions?

JR

Webmaster
http://www.izmirhigh.com/index.shtml
Quote Reply
Re: SSI or Include in sub html_home In reply to
Joe - put the following in sub html_home - I put it just after &html_top

open (DB, "<$db_file_name") or
&cgierr(" unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
@lines = <DB>;
close DB;
$count = scalar(@lines);

And then wherever you want to print the number use $count

Hope this helps!
------------------
donm

Quote Reply
Re: SSI or Include in sub html_home In reply to
Don,
There I go making it more difficult then it needs to be again, ugh.
Works like a charm now.
Thx.
JR

Webmaster
http://www.izmirhigh.com/index.shtml
Quote Reply
Re: SSI or Include in sub html_home In reply to
No problem Joe - glad I could help out.

----------------
donm