I'm struggling with trying to display 25 records out of a MySQL table at a time. I know what <dtml-in> does but not how to control how many results per page I get and how to create links that navigate between batches. How it works is that when the user arrives at the homepage, they see the first set of 25 records. By clicking on "Next", they get the next set of records. Can this be done with index_html or do I need a seperate page to display the next sets of batches and to navigate those sets of records? This is the code I'm working on: <dtml-in listEntryID> <tr> <td height="22" class="categories" width="80"> <font size="1" class="categories"> <dtml-var firstname missing="N/A"> </font> </td> <td height="22" class="categories" width="148"> <dtml-var lastname missing="N/A"> </td> <td width="51" height="22"><a href="editContact?entry_ID=<dtml-var entry_ID missing="">" target="_top"><img src="edit.png" width="50" height="20" border="0"></a></td> <td width="92" height="22"><a href="del_form?entry_ID=<dtml-var entry_ID missing="">"><img src="delete.png" width="50" height="20" border="0"></a></td> </tr> </dtml-in> listEntryID is my Z SQL Method that pulls all records from a table, BTW.
See http://www.zope.org/Documentation/ZopeBook/AdvDTML.stx about batching with DTML-IN. All attributes for dtml-in are also described in Appendix A of Zope Book (see 'size' parameter). -aj ----- Original Message ----- From: "Douglas Perry" <doug@safety.com> To: <zope@zope.org> Sent: Tuesday, June 11, 2002 12:25 Subject: [Zope] Clueless About <dtml-in> and Sequencing.
I'm struggling with trying to display 25 records out of a MySQL table at a time. I know what <dtml-in> does but not how to control how many results per page I get and how to create links that navigate between batches.
How it works is that when the user arrives at the homepage, they see the first set of 25 records. By clicking on "Next", they get the next set of records. Can this be done with index_html or do I need a seperate page to display the next sets of batches and to navigate those sets of records?
This is the code I'm working on:
<dtml-in listEntryID> <tr> <td height="22" class="categories" width="80"> <font size="1" class="categories"> <dtml-var firstname missing="N/A"> </font> </td> <td height="22" class="categories" width="148"> <dtml-var lastname missing="N/A"> </td> <td width="51" height="22"><a href="editContact?entry_ID=<dtml-var entry_ID missing="">" target="_top"><img src="edit.png" width="50" height="20" border="0"></a></td> <td width="92" height="22"><a href="del_form?entry_ID=<dtml-var entry_ID missing="">"><img src="delete.png" width="50" height="20" border="0"></a></td> </tr> </dtml-in>
listEntryID is my Z SQL Method that pulls all records from a table, BTW.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
You can do this all in index_html. try something like this: <dtml-in listEntryID size=25 start=qs> ---display stuff here--- <dtml-if sequence-end> <dtml-if previous-sequence-start-number> <a href="<dtml-var URL><dtml-var sequence-query>qs=<dtml-var previous-sequence-start-number>"><< Previous</a> </dtml-if> <dtml-if next-sequence-start-number> <a href="<dtml-var URL><dtml-var sequence-query>qs=<dtml-var next-sequence-start-number>">Next >></a> </dtml-if> </dtml-if> </dtml-in> On Tue, Jun 11, 2002 at 12:25:46PM -0400, Douglas Perry wrote:
I'm struggling with trying to display 25 records out of a MySQL table at a time. I know what <dtml-in> does but not how to control how many results per page I get and how to create links that navigate between batches.
How it works is that when the user arrives at the homepage, they see the first set of 25 records. By clicking on "Next", they get the next set of records. Can this be done with index_html or do I need a seperate page to display the next sets of batches and to navigate those sets of records?
This is the code I'm working on:
<dtml-in listEntryID> <tr> <td height="22" class="categories" width="80"> <font size="1" class="categories"> <dtml-var firstname missing="N/A"> </font> </td> <td height="22" class="categories" width="148"> <dtml-var lastname missing="N/A"> </td> <td width="51" height="22"><a href="editContact?entry_ID=<dtml-var entry_ID missing="">" target="_top"><img src="edit.png" width="50" height="20" border="0"></a></td> <td width="92" height="22"><a href="del_form?entry_ID=<dtml-var entry_ID missing="">"><img src="delete.png" width="50" height="20" border="0"></a></td> </tr> </dtml-in>
listEntryID is my Z SQL Method that pulls all records from a table, BTW.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Tue, Jun 11, 2002 at 09:31:13AM -0700, Kevin Lewandowski wrote:
You can do this all in index_html.
... but I wouldn't. The O in Zope stands for Object... zope allows you to benefit from object-oriented design, why not take advantage of it? I'd put all the sequence stuff in a separate object. You like dtml, fine, do it as a dtml method, call it my_sql_sequence_display or whatever you like. Then index_html only needs to contain this: <dtml-var my_sql_sequence_display> Now index_html is easier to read, my_sql_sequence_display has one and only one job that's easy to understand, and if you ever need to use that sequence display somewhere else, you can. -- Paul Winkler home: http://www.slinkp.com "Muppet Labs, where the future is made - today!"
participants (4)
-
Andreas Jung -
Douglas Perry -
Kevin Lewandowski -
Paul Winkler