Thread: psql & HTML

psql & HTML

From
Leif Jensen
Date:
   Hi there,

  I have been using psql's HTML option for quite some time to generate
intranet tables from our corporate database, which works very nicely.

  I wonder if anyone has been extending this feature for better control of
the output. At the moment I am piping output through several 'sed's to
control table attributes like bgcolor, alignment, etc. It's very difficult
to control individual columns, using colgroups, etc. this way. I would
like some kind of additional options making it possible to add table
attributes as well as making layout control easier.

  I have been thinking of having a look at the psql source for adding such
features if they don't already exists, and I would welcome any suggestions
in this respect !

  Greetings,

 Leif



Re: psql & HTML

From
David A Dickson
Date:
It is very easy to interact with postgres using php. With php you can
select the rows from the tables you want and echo it to the web browser in
any format you desire.

On Fri, 15 Feb 2002, Leif Jensen wrote:

>
>    Hi there,
>
>   I have been using psql's HTML option for quite some time to generate
> intranet tables from our corporate database, which works very nicely.
>
>   I wonder if anyone has been extending this feature for better control of
> the output. At the moment I am piping output through several 'sed's to
> control table attributes like bgcolor, alignment, etc. It's very difficult
> to control individual columns, using colgroups, etc. this way. I would
> like some kind of additional options making it possible to add table
> attributes as well as making layout control easier.
>
>   I have been thinking of having a look at the psql source for adding such
> features if they don't already exists, and I would welcome any suggestions
> in this respect !
>
>   Greetings,
>
>  Leif
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

--
David A Dickson
david.dickson@mail.mcgill.ca


Re: psql & HTML

From
Alaric B Snell
Date:
On Friday 15 February 2002 10:57, Leif Jensen wrote:
>    Hi there,
>
>   I have been using psql's HTML option for quite some time to generate
> intranet tables from our corporate database, which works very nicely.
>
>   I wonder if anyone has been extending this feature for better control of
> the output. At the moment I am piping output through several 'sed's to
> control table attributes like bgcolor, alignment, etc. It's very difficult
> to control individual columns, using colgroups, etc. this way. I would
> like some kind of additional options making it possible to add table
> attributes as well as making layout control easier.
>
>   I have been thinking of having a look at the psql source for adding such
> features if they don't already exists, and I would welcome any suggestions
> in this respect !

How about this idea: A more general HTML report generation program, that
happens to come with a PSQL backend to start with (perhaps it should be write
in Java or PHP or something?) but isn't really Postgres specific, that allows
the user to set up a SELECT (just a text box will be fine, it's really tricky
to write a GUI for that kind of thing a la Access) then provide HTML snippets
for:

1) Header, including the <TABLE> element - defaults to
     <HTML><HEAD><TITLE>$TITLE$</TITLE></HEAD><BODY><TABLE>
2) Start of column name row - defaults to <TR>
3) Column name cells - defaults to <TH>$HEADING$</TH>
4) End of column name row - defaults to </TR>
5) Start of data row - <TR>
6) Data cell - <TD>$DATA</TD>
7) End of data row - </TR>
8) Footer - </TABLE></BODY></HTML>

With time, it can be extended to:

1) Have a simple conditional thing so alternate rows can be coloured
differently to make the rows easier to follow, negative numbers can come out
in red, etc

2) Do some aggregration, like adding TOTAL, without having to do a seperate
SELECT SUM(foo) and stitch it into the table

3) Group by the primary sort key for a SORTed query, then producing a single
cell with a ROWSPAN for each distinct value of that field

4) Break the result into pages

5) Produce charts

etc...

Any takers?

>
>  Leif
>

ABS

--
Alaric B. Snell, Developer
abs@frontwire.com

Re: psql & HTML

From
Lincoln Yeoh
Date:
Actually I'm one of those who thinks these sort of features (including the
existing html display stuff) don't belong in psql.

It's much better to use a different tool to do it (e.g. a perl, php, java,
C++, etc program, a reporting tool, and so on).

By the time you need fancier display features than what psql already
provides you usually would be looking for something less "rube
goldbergish". Then again, I mentioned perl (and use it) so feel free to
ignore me :).

Seriously tho, when you start to get more users you might find that
shell+psql+sed+sed+sed+etc strung together won't be able to keep up with
the load.

Cheerio,
Link.

At 11:57 AM 2/15/02 +0100, Leif Jensen wrote:
>
>   Hi there,
>
>  I have been using psql's HTML option for quite some time to generate
>intranet tables from our corporate database, which works very nicely.
>
>  I wonder if anyone has been extending this feature for better control of
>the output. At the moment I am piping output through several 'sed's to
>control table attributes like bgcolor, alignment, etc. It's very difficult
>to control individual columns, using colgroups, etc. this way. I would
>like some kind of additional options making it possible to add table
>attributes as well as making layout control easier.
>
>  I have been thinking of having a look at the psql source for adding such
>features if they don't already exists, and I would welcome any suggestions
>in this respect !
>
>  Greetings,
>
> Leif
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>
>


Re: psql & HTML

From
Medi Montaseri
Date:
I agree with Lincoln.....this HTML GUI stuff is the not the first wall paper
and
will not be the last  wall paper. I vote for keeping such cosmetics and
presentation
out of the database. Lets not be what .coms tried to be. Start on a core and
grow
to sell underware, cigerates, and everything else....let keep the focus on
data
management.

Lincoln Yeoh wrote:

> Actually I'm one of those who thinks these sort of features (including the
> existing html display stuff) don't belong in psql.
>
> It's much better to use a different tool to do it (e.g. a perl, php, java,
> C++, etc program, a reporting tool, and so on).
>
> By the time you need fancier display features than what psql already
> provides you usually would be looking for something less "rube
> goldbergish". Then again, I mentioned perl (and use it) so feel free to
> ignore me :).
>
> Seriously tho, when you start to get more users you might find that
> shell+psql+sed+sed+sed+etc strung together won't be able to keep up with
> the load.
>
> Cheerio,
> Link.
>
> At 11:57 AM 2/15/02 +0100, Leif Jensen wrote:
> >
> >   Hi there,
> >
> >  I have been using psql's HTML option for quite some time to generate
> >intranet tables from our corporate database, which works very nicely.
> >
> >  I wonder if anyone has been extending this feature for better control of
> >the output. At the moment I am piping output through several 'sed's to
> >control table attributes like bgcolor, alignment, etc. It's very difficult
> >to control individual columns, using colgroups, etc. this way. I would
> >like some kind of additional options making it possible to add table
> >attributes as well as making layout control easier.
> >
> >  I have been thinking of having a look at the psql source for adding such
> >features if they don't already exists, and I would welcome any suggestions
> >in this respect !
> >
> >  Greetings,
> >
> > Leif
> >
> >
> >
> >---------------------------(end of broadcast)---------------------------
> >TIP 5: Have you checked our extensive FAQ?
> >
> >http://www.postgresql.org/users-lounge/docs/faq.html
> >
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

--
-------------------------------------------------------------------------
Medi Montaseri                               medi@CyberShell.com
Unix Distributed Systems Engineer            HTTP://www.CyberShell.com
CyberShell Engineering
-------------------------------------------------------------------------




Re: psql & HTML

From
Leif Jensen
Date:
    Hi,

  I hate to agree with you  Lincoln and Medi ;-), but I DO. It's just that
this helped me overcome a hurdle of learning HTML and ... and to get a
quick and dirty way of creating simple reports on our intranet. Otherwise
we might never have gotten here.

  I suppose there doesn't exist an HTML report generator already as Alaric
suggests !? I love the idea ! When can I have it ? :-).

  I have been looking a little into using PHP for making my reports
better, but I seem to be banging my head against some closed doors
:-(. I'm not able to locate a good documentation on how to use PHP and
PostgreSQL. I'm using Apache (of course) and it is PHP enabled (I get the
login screen when trying phpPgAdmin, and I can run small simple php
examples). I just can't get into PostgreSQL.

  Where do I find a good tutorial/reference to set up
Apache/PHP/PostgreSQL ??

   Please help,

 Leif


My system:  Slackware 8.0
            Apache
            PHP 4.0 (part of Slw8.0 installation)
            PostgreSQL 7.1.3



On Fri, 15 Feb 2002, Medi Montaseri wrote:

> I agree with Lincoln.....this HTML GUI stuff is the not the first wall paper
> and
> will not be the last  wall paper. I vote for keeping such cosmetics and
> presentation
> out of the database. Lets not be what .coms tried to be. Start on a core and
> grow
> to sell underware, cigerates, and everything else....let keep the focus on
> data
> management.
>
> Lincoln Yeoh wrote:
>
> > Actually I'm one of those who thinks these sort of features (including the
> > existing html display stuff) don't belong in psql.
> >
> > It's much better to use a different tool to do it (e.g. a perl, php, java,
> > C++, etc program, a reporting tool, and so on).
> >
> > By the time you need fancier display features than what psql already
> > provides you usually would be looking for something less "rube
> > goldbergish". Then again, I mentioned perl (and use it) so feel free to
> > ignore me :).
> >
> > Seriously tho, when you start to get more users you might find that
> > shell+psql+sed+sed+sed+etc strung together won't be able to keep up with
> > the load.
> >
> > Cheerio,
> > Link.
> >
> > At 11:57 AM 2/15/02 +0100, Leif Jensen wrote:
> > >
> > >   Hi there,
> > >
> > >  I have been using psql's HTML option for quite some time to generate
> > >intranet tables from our corporate database, which works very nicely.
> > >
> > >  I wonder if anyone has been extending this feature for better control of
> > >the output. At the moment I am piping output through several 'sed's to
> > >control table attributes like bgcolor, alignment, etc. It's very difficult
> > >to control individual columns, using colgroups, etc. this way. I would
> > >like some kind of additional options making it possible to add table
> > >attributes as well as making layout control easier.
> > >
> > >  I have been thinking of having a look at the psql source for adding such
> > >features if they don't already exists, and I would welcome any suggestions
> > >in this respect !
> > >
> > >  Greetings,
> > >
> > > Leif
> > >
> > >
> > >
> > >---------------------------(end of broadcast)---------------------------
> > >TIP 5: Have you checked our extensive FAQ?
> > >
> > >http://www.postgresql.org/users-lounge/docs/faq.html
> > >
> > >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
> --
> -------------------------------------------------------------------------
> Medi Montaseri                               medi@CyberShell.com
> Unix Distributed Systems Engineer            HTTP://www.CyberShell.com
> CyberShell Engineering
> -------------------------------------------------------------------------
>
>
>



Re: psql & HTML

From
flume33@yahoo.com
Date:
> Where do I find a good tutorial/reference to set up
> Apache/PHP/PostgreSQL ??

Scroll down to the postgres section
http://www.phpbuilder.com/columns/

    - Getting Started with Postgres on Redhat7.0
    http://www.phpbuilder.com/columns/kevin20010314.php3

    - Linux Journal: Web Applications With PHP And PostgreSQL
    http://www.phpbuilder.com/columns/linuxjournal200009.php3

Jeff