🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.perl
7 messages
7 total messages Started by johnvv Fri, 24 Apr 1998 17:12
Auto-generate HTML Tables
#1277
Author: johnvv
Date: Fri, 24 Apr 1998 17:12
26 lines
1727 bytes
Hello all,


 I have been making really groovy reports based on the HP glance product while
 using MLDBM and Freeze/Thaw ( or REFER, I like trucks and rednecks, more on
 that later ) and have been displaying with gnuplot and Gifgraph ( which I
 would very much like to see integrated ) garnished with bezier and linear
 regression.

 The static output (num of disks, cpus, memory ) files look very nice in
tables
 within tables for the doubled bevel look and my question is this.

 Has anybody created a script which automagically genetrates tables from
 complex structures or flatfiles.  I would be very nice to HREF the cells in
 the process.

 Its been two years since I touched cgi, I'll have more later.

 Thanx in advance, John van V. aka johnvv@hotmail.com or johnvv@earthling.net

passme


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading
Re: Auto-generate HTML Tables
#1278
Author: Jeff
Date: Fri, 24 Apr 1998 18:54
57 lines
2475 bytes
Open the file you want to use to create the tables.  
Depending on what type of file you are using you'll do the following
in some fashion (the following is for a fixed length text file):


print "<html>\n";
print "<head>\n";
print "</head>\n";
print "<body>\n";
print "<table +any tags>\n";
open(F, $filename) || die "File can not be opened";
	while (defined ($line = <F>)) {
    	    @data = $line =~/(.{8})(.{10})(.{8})(.{30})(.{14})/;
		print "<tr>\n";
		print "<strong>\n";
		print "<td> ",$data[0],"</td>";
		print "<td> ",$data[1],"</td>";
		print "<td> ",$data[2],"</td>";
		print "<td> ",$data[3],"</td>";
		print "<td> ",$data[4],"</td>";
	}
print "</table>\n";
print "</body>\n";
print "</html>\n";





On Fri, 24 Apr 1998 11:12:06 -0600, johnvv@earthling.net wrote:

>Hello all,
>
>
> I have been making really groovy reports based on the HP glance product while
> using MLDBM and Freeze/Thaw ( or REFER, I like trucks and rednecks, more on
> that later ) and have been displaying with gnuplot and Gifgraph ( which I
> would very much like to see integrated ) garnished with bezier and linear
> regression.
>
> The static output (num of disks, cpus, memory ) files look very nice in
>tables
> within tables for the doubled bevel look and my question is this.
>
> Has anybody created a script which automagically genetrates tables from
> complex structures or flatfiles.  I would be very nice to HREF the cells in
> the process.
>
> Its been two years since I touched cgi, I'll have more later.
>
> Thanx in advance, John van V. aka johnvv@hotmail.com or johnvv@earthling.net
>
>passme
>
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/   Now offering spam-free web-based newsreading
Re: Auto-generate HTML Tables
#1279
Author: Jonathan Stowe
Date: Fri, 24 Apr 1998 20:02
55 lines
2180 bytes
On Fri, 24 Apr 1998 11:12:06 -0600, johnvv@earthling.net wrote:

<snip>

> Has anybody created a script which automagically genetrates tables from
> complex structures or flatfiles.  I would be very nice to HREF the cells in
> the process.
>

Yes, I have and I'm sure on or two others have around here as well.

However the nearest example I have takes as input some files output by
Lotus Organizer (Yeuch). And i dont think it will be quite what you
want  

Just as an example here is the bit that prints the tabley bits:

sub printdetail()
{
    my ($config,$room,%details) = @_;
    my $m_time = "";

    print "   <H2>",$room,"</H2>\n" unless (lc($config->{USECATEGORY})
eq "no" )
    print "   <TABLE>\n";

    foreach $m_time (sort keys %details )
      {
        my $m_description = $details{$m_time};
        print <<EOPD;
        <TR>
           <TD>
             $m_time
           </TD>
           <TD>
             $m_description
           </TD>
        </TR>
EOPD
      }
   print "   </TABLE>\n";
}

I leave it as an example to guess how you get the stuff that is
printed.

Hmm, why *did* I do it like that ?

> Its been two years since I touched cgi, I'll have more later.
>
Lucky you.

/J\
Jonathan Stowe
See the MetaFaq at http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm
Re: Auto-generate HTML Tables
#1280
Author: Reza Naima
Date: Sun, 26 Apr 1998 21:41
38 lines
1747 bytes
Jonathan Stowe wrote:
> 
> On Fri, 24 Apr 1998 11:12:06 -0600, johnvv@earthling.net wrote:
> 
> <snip>
> 
> > Has anybody created a script which automagically genetrates tables from
> > complex structures or flatfiles.  I would be very nice to HREF the cells in
> > the process.
> 

I've come up with a very simple approach....  you feed my module an
array of arrys, and it takes that and forms a table from it.  It's also
expandable.  for example, to create a report from DBI, you can do
something like


$q = $dbh->prepare('select name, phonenumber from address_book)' or die
($DBI::errstr);
$q->execute();

$table = new Table;
$table->{content} = [ {contentstyle->['font color=white','i'],
			style=>'bgcolor=blue',
			content=>['Name','Phone Number']
			}
			];

push @{$table->{content}}, @{$q->fetchrow_arrayref};

print $table->generate();

===

and that's all it takes to make a table, with a cool header.
let me know if there would be any interest in it.

Reza
Re: Auto-generate HTML Tables
#1281
Author: Dan Baker
Date: Sun, 26 Apr 1998 22:29
45 lines
2121 bytes
Reza Naima wrote:
> 
> Jonathan Stowe wrote:
> >
> > On Fri, 24 Apr 1998 11:12:06 -0600, johnvv@earthling.net wrote:
> >
> > <snip>
> >
> > > Has anybody created a script which automagically genetrates tables from
> > > complex structures or flatfiles.  I would be very nice to HREF the cells in
> > > the process.
> >
> 
> I've come up with a very simple approach....  you feed my module an
> array of arrys, and it takes that and forms a table from it.  It's also
> expandable.  for example, to create a report from DBI, you can do
> something like
> 
> $q = $dbh->prepare('select name, phonenumber from address_book)' or die
> ($DBI::errstr);
> $q->execute();
> 
> $table = new Table;
> $table->{content} = [ {contentstyle->['font color=white','i'],
>                         style=>'bgcolor=blue',
>                         content=>['Name','Phone Number']
>                         }
>                         ];
> 
> push @{$table->{content}}, @{$q->fetchrow_arrayref};
> 
> print $table->generate();
> 
> ===
> 
> and that's all it takes to make a table, with a cool header.
> let me know if there would be any interest in it.
> 
> Reza
--------------------
sounds pretty cool! do you have somewhere on the web you can put it for
download? or, maybe submit it to Matt's script archive (or some other
one?) ?

Dan
Re: Auto-generate HTML Tables
#1282
Author: Reza Naima
Date: Mon, 27 Apr 1998 20:07
34 lines
2059 bytes
Dan Baker wrote:

> > $table = new Table;
> > $table->{content} = [ {contentstyle->['font color=white','i'],
> >                         style=>'bgcolor=blue',
> >                         content=>['Name','Phone Number']
> >                         }
> >                         ];
> >
> > push @{$table->{content}}, @{$q->fetchrow_arrayref};
> >
> > print $table->generate();

> > and that's all it takes to make a table, with a cool header.
> > let me know if there would be any interest in it.

> --------------------
> sounds pretty cool! do you have somewhere on the web you can put it for
> download? or, maybe submit it to Matt's script archive (or some other
> one?) ?
> 
> Dan

What's matt's script archive?  I suppose I'de need to thow some
documentation for it together first, as it can be used in a fairly
complex manner if you wanted to.  I could drop in in CPAN, but there are
already a bunch of HTML::Table's out there.  

For the time being, I threw that and a couple of other modules I wrote
on

	http://www.reza.net/perl

Reza
Re: Auto-generate HTML Tables
#1283
Author: johnvv
Date: Tue, 28 Apr 1998 22:52
79 lines
2503 bytes

> I've come up with a very simple approach....
Nice..

> you feed my module an
> array of arrys, and it takes that and forms a table from it.  It's also
> expandable.

Actually this looks perfect, however...

Here is my test.
___________________________________________________________________________


use Table ;
$q = [ [ undef  , undef , undef , a , b , c ] , [ 1 , 2 , 3, 4 , 5 ] ] ;
$table = new Table;
$table->{content} = [ {contentstyle->['font color=white','i'],
                        style=>'bgcolor=blue border=5',
                        content=>['Name','Phone Number']
                        }
                        ];

push @{$table->{content}}, @{$q};
print $table->generate();

______________________________________________________________________________


This produced only:


<table >
        <tr >
        </tr>
        <tr>
                <td></td>
                <td></td>
                <td></td>
                <td>a</td>
                <td>b</td>
                <td>c</td>
        </tr>
        <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
                <td>4</td>
                <td>5</td>
        </tr>

</table>

W/O any table attributes.  How do you get it pretty'd up ??

Also, how would you implement HREFS in it ??

I would seriously consider going CPAN w/ it as well.

Thanks again in advance,  John van V.
















-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads