Covert dbase to html tables?
A. Bullen
abullen at nslsilus.org
Mon Oct 28 11:56:04 EST 1996
-- [ From: A. Bullen * EMC.Ver #2.5.02 ] --
We use a perl 5 module called XBase to convert a .DBF record into an HTML
page. The module can be found at http://www.csuchico.edu/prnt/perl-lib/.
Xbase-1.07/Xbase.html. The .DBF/.IDX files are upload through FTP, a command
is issued, and a Perl script converts the records into HTML. I am indexing
them through HT-DIG, which provides for keyword searches, etc.
Here is my Perl code: (I took out all of the tab stops for display purposes)
#!/usr/bin/perl
use Xbase;
$fname="/usr/local/httpd/htdocs/regio/resource/library.dbf";
$df=new Xbase;
$out=$df->open_dbf($fname);
$FIZZLE=0;
system "rm /usr/local/httpd/htdocs/regio/resource/ResourceExpress/*.html";
&traverse_dbf;
sub traverse_dbf
{
++$FIZZLE;
open (MAIL, ">
/usr/local/httpd/htdocs/regio/resource/ResourceExpress/$FIZZLE.html");
print MAIL "<HTML>\n";
$cmd=$df->get_field("PGMNAME");
print MAIL "<Head><Title>Resource Express Record for $cmd\n";
print MAIL "</Title>\n";
print MAIL "<I>Resource Express® Search (847) 577-7070</I></HEAD>\n";
print MAIL "<P><HR><P>\n";
$cmd=$df->get_field("AGNAME");
print MAIL "<B>$cmd\n</B>";
print MAIL "<P>\n";
$cmd=$df->get_field("AGADDRESS");
print MAIL "<B>$cmd\n</B>";
print MAIL "<BR>\n";
$cmd=$df->get_field("AGCITY");
print MAIL "$cmd\n";
print MAIL "<BR>\n";
$cmd=$df->get_field("AGSTATE");
print MAIL "$cmd, ";
$cmd=$df->get_field("AGZIP");
print MAIL "$cmd\n";
print MAIL "<P>\n";
$cmd=$df->get_field("AGPHONE");
print MAIL "$cmd\n";
print MAIL "<P><P>\n";
$cmd=$df->get_field("PGMNAME");
print MAIL "<B>$cmd</B>\n";
print MAIL "<P>\n";
$cmd=$df->get_field("PGMINFO");
print MAIL "$cmd\n";
print MAIL "<P>\n";
print MAIL "</HTML>\n";
close MAIL;
$df->go_next;
$cmd=$df->eof;
if ($cmd==1){
kill 1;
}
else {
&traverse_dbf;
}
}
system "chmod 644 /usr/local/httpd/htdocs/regio/resource/ResourceExpress/*.
html";
$df->close_dbf;
More information about the Web4lib
mailing list