[Zope] How to format database query?

Dieter Maurer dieter@handshake.de
Tue, 3 Sep 2002 21:42:19 +0200


Renier Leenders writes:
 > I make a query in postgresql with:
 > select * from table_name
 > 
 > and i put it in html with:
 > <dtml-in wet_query>
 >      <b> <dtml-var field1>.</b> <dtml-var field2>
 > </dtml-in>
 > 
 > field1 is a char field and field2 is a text field (column)
 > 
 > How can i format this output? Is it possible in dtml or python?
 > I think it must be possible with somekind of string manipulation but is don't 
 > know how to inplement it.
How do you want to format the result?

Usually, you would use HTML to format the result of Z SQL Methods.
Look at "Z Search Interface" (in your "Add" list), for an example.

Only, when you want to format material *inside* a result column,
you need Zope help. But, you need to tell us, how you want to
format this. On possibility is the "newline_to_br" attribute
to "dtml-var". It converts newslines to <br> and thus provides
for some form of formatting. Another is 'fmt="structured-text"'.
It converts structured text into HTML.


I suggest, you look at some example in the Zope Book...



Dieter