[Zope-DB] Using Page templates and viewing results from a zsql method

Dario Lopez-Kästen dario at ita.chalmers.se
Thu Aug 19 12:51:04 EDT 2004


Laura McCord wrote:

> Hi,
> 
>  I have a page template that contains various links, such as
> Applications, CPU, Operating System, etc...
> 
> These links all trigger an sql method. For example, if I select the link
> Applications, a web page will open displaying a listing of installed
> applications on a computer. 
> 
> My question is, how can I get the results of the sql method to appear
> below the links (on the same page)?
> 

for instance, you use a tal:repeat statement with the results of either 
the ZSQLmethod itself, or with the results of a Script(Python) that 
returns a list or a dictionary.

example:

<tal:listing define="myList python: here.getMyList()">

   <table>
   <tal:span condition="myList" repeat="myItem myList">
   <tr>
     <td tal:content="myItem"> an Item </td>
   </tr>
   </tal:span>

   <!-- EMPTY SEARCH RESULT, INFORMATION TEXT -->
   <tal:span condition="not: myList" >
   <tr>
     <td>No items in list!</td>
   </tr>
   </tal:span>
   </table>

</tal:listing>

You really need to read up ZPT in the Zope book - this is all fairly 
well described there.

Hope this helps,

/dario

-- 
-- -------------------------------------------------------------------
Dario Lopez-Kästen, IT Systems & Services Chalmers University of Tech.


More information about the Zope-DB mailing list