[Zope] [Fwd: displaying results returned structured in ZPT]

dean hale dean.hale at sunderland.ac.uk
Mon Aug 11 11:10:50 EDT 2003


Hi All,

Any advice on below is appreciated.

Currently have a ZPT page which returns results from a zsql query. All
works fine however unsure how to ensure the results returned are
structured correctly. The content displays a number of /n and /r s.

have had a look around and assume this is what needs  to be done
(probably wrong)

     tal:define="
       std modules/Products/PythonScript/standard;
       st nocall: std/structured_text;
       page_body python: st(getattr(variable,page_body));
       "
     tal:content="structure page_body"

however not sure what needs to be replaced for it to work in our example
(snipped), which is below.

   <body tal:define="results  here/detail;
                     start request/start|python:0;
                     batch python:modules['ZTUtils'].Batch(results,
                                                           size=20,
                                                           start=start);
                     previous python:batch.previous;
                     next python:batch.next">
					

     <td width="500" valign="top">    <a tal:condition="previous"
        tal:attributes="href
string:${request/URL0}?start:int=${previous/first}"
        href="previous_url">previous <span
tal:replace="previous/length">20</span> results</a>
     <a tal:condition="next"
        tal:attributes="href string:${request/URL0}?start:int=${next/first}"
        href="next_url">next <span tal:replace="next/length">20</span>
results</a>

   <p>
     <a tal:condition="previous"
        tal:attributes="href
string:${request/URL0}?start:int=${previous/first}"
        href="previous_url">previous <span
tal:replace="previous/length">20</span> results</a>
     <a tal:condition="next"
        tal:attributes="href string:${request/URL0}?start:int=${next/first}"
        href="next_url">next <span tal:replace="next/length">20</span>
results</a>
   </p>

   <table width="90%" border="0" class="programme">
     <div tal:repeat="result batch" >
       <tr valign="top">
         <td><strong>Subject</strong></td>
         <td><strong><font size="3" face="Verdana, Arial, Helvetica,
sans-serif"><span tal:replace="result/Subject">Subject
           goes here</span></font></strong></td>
       </tr>
       <tr valign="top">
         <td><strong>Course Title</strong></td>
         <td><span tal:replace="result/CourseTitle">CourseTitle goes
here</span></td>
       </tr>

snip

Thanks for your help
dean



-- 

Dean Hale
Information Services

Web Development Manager
0191 515 2424




More information about the Zope mailing list