OpenWGA 7.11 - WebTML reference
WebTML tags » foreach<tml:foreach pagesize ="1...n">
Purpose:
Dividing up the output into separate pages, each holding the number of results specified
Description:
If you do not want do display all results of the tag on on page, you can divide up the output using this attribute. Specifying a pagesize of 10 will let only 10 results be displayed per page.
The <tml:foreach> tag offers some ways to change the page of the result that is currently displayed:
The tags (<tml:url>) types type="nextpage|previouspage|selectpage" allow you to generate links to other result pages. These URLs display the same WebTML page, but with the next(nextpage) or the previous(previouspage) or a specified(selectpage) page of n results. Whether such pages exist can be checked with the conditions hasnextpage, haspreviouspage or with the tag-infos of <tml:foreach> which show you on which page you currently are and how many there are in total.Another way is to use the attribute page on <tml:foreach> to explicitly choose the number of the page to be displayed. You can calculate this attribute value by any mechanism that you need to implement the wanted paging behaviour. The value 1 represents the first page, the value 2 the second, and so on ...
Yet another way is to control the displayed page by setting the internal WebTML-variable "$idPage". $id should be replaced by the id of your foreach tag.This variable sets the currently displayed page of your tag. It should be set before the <tml:foreach> tag is evaluated.
Value(s):
Examples:
<tml:collection>
<tml:query cache="false" type="lucene" includecurrent="true"><tml:item type="tmlform" name="query"/></tml:query>
<table width="100%">
<tr>
<td>Titel</td>
<td>Typ</td>
<td>Created</td>
</tr>
<tml:foreach id="hotpages" pagesize="5">
<tr>
<td><tml:link/></td>
<td><tml:meta name="doctype"/></td>
<td><tml:meta name="created"/></td>
</tr>
</tml:foreach>
</table>
</tml:collection>
The following codes displays URLs to scroll over the result pages.Also it displays which documents of the result set are currently displayed:
<table width="100%" border=0>
<tr>
<td align="left">
<tml:case haspreviouspage="hotpages">
<a href="<tml:url type="previousPage" sourcetag="hotpages" form="search"/>">Previous page</a>
</tml:case>
</td>
<td align="center">
Document <tml:taginfo sourcetag="hotpages" name="startindex"/> to <tml:taginfo sourcetag="hotpages" name="endindex"/> from <tml:taginfo sourcetag="hotpages" name="count"/>.
</td>
<td align="right">
<tml:case hasnextpage="hotpages">
<a href="<tml:url type="nextPage" sourcetag="hotpages" form="search"/>">Next page</a>
</tml:case>
</td>
</tr>
</table>