MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

RE: DB Headings -solved



******    message to minivend-users from "Yossi Cohen" <yossic@msn.com>     ******

Hi,

Here's something that I put with Mike's help, using dbinfo.
You can use this page with the value of mv_data_table set from another
form/page, or replace it with the actual database you're interested in.

Yossi

[set name=myFields interpolate=1][calc]
q{[dbinfo table='[value mv_data_table]' columns=1 joiner=',']}
[/calc][/set]

<TABLE Border=0>
<TR BgColor=Beige><TH>code</TH><TH>[dbinfo table='[value mv_data_table]'
columns=1 joiner="</TH><TH>"]</T
H></TR>
<TR MV="tag" MV.op="each [value mv_data_table]" BgColor=Wheat>
        <TD NoWrap>[loop-code]</TD>
        <TD VAlign=TOP MV="loop" MV.with="-a" MV.arg="[scratch myFields]"
NoWrap>
        [data base='[value mv_data_table]' field=[loop-code-a]
key=[loop-code]]</TD>
</TR>
</TABLE>


-----Original Message-----
From: owner-minivend-users@minivend.com
[mailto:owner-minivend-users@minivend.com]On Behalf Of August Detlefsen
Sent: Wednesday, April 14, 1999 4:29 PM
To: minivend-users@minivend.com
Subject: Re: DB Headings -solved


******    message to minivend-users from August Detlefsen
<augustd@idiom.com>     ******

> Is there a way to get a list of all the DB column headings? I want to
create a page that just outputs a simple table of every row and every column
of the database. The rows are easy, but is there a way to automatically grab
all the column headers?

This is the solution I used. If anyone has a simpler/more efficient
solution, please tell me.

in Minivend.cfg:

GlobalSub <<EOF
sub db_heads2 {

   my $table = shift();
   my $heads = '';

   open (TABLE, "$table") or return "Can't open table \($table\): $!";
   while (<TABLE>) {
     $heads = $_;
     close TABLE;
   }
   $Vend::Session->{'scratch'}->{'heads'} = $heads;
   return;
}
EOF

in my page:

[perl arg=sub]db_heads2('/path/to/file/database.asc');[/perl]

<TABLE BORDER=1>
<TR>
[loop arg="[scratch heads]"]
<TH ALIGN=center VALIGN=middle>[loop-code]</TD>
[/loop]
</TR>
[tag each products]
<TR>
[loop arg="[scratch heads]" with="-a"]
<TD ALIGN=center VALIGN=middle>[field name="[loop-code-a]"
code=[loop-code]]</TD>
[/loop]
</TR>
[/tag]
</TABLE>

That's it. It outputs a nice html table with every entry in your DB.
Currently only tested on products.asc, and that [tag each products] will
have to change to use it elsewhere.

-August
--
August Detlefsen - Internet Consultant - Web Designer
  mailto:augustd@idiom.com
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to
Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: