Hi,
i'm currently working on a webservice module which sends a request to a branchbook service. Fetching the branchbook entries works fine, all are stored in one array.
To display the entries i use a dataObjectSet with following code:
$output = new DataObjectSet();
$output->setPageLimits((intval($_GET['start']) ? $_GET['start'] : 0), 5, sizeof($entries));
foreach($entries as $entry) {
$output->push(new ArrayData($entry));
}
return $output;
and in the template
<% if Entries.MoreThanOnePage %>
<div id="PageNumbers">
<% if Entries.NotLastPage %>
<a class="next" href="$Entries.NextLink" title="View the next page">Next</a>
<% end_if %>
<% if Entries.NotFirstPage %>
<a class="prev" href="$Entries.PrevLink" title="View the previous page">Prev</a>
<% end_if %>
<span>
<% control Entries.Pages %>
<% if CurrentBool %>
$PageNum
<% else %>
<a href="$Link" title="View page number $PageNum">$PageNum</a>
<% end_if %>
<% end_control %>
</span>
<p>Page $Entries.CurrentPage of $Entries.TotalPages</p>
</div>
<% end_if %>
<% control Entries %>
<h2>$customer</h2>
<% end_control %>
Although i've set to display only 5 entries per page all entries are displayed.
Pagination at the beginning of the template works fine. The list of available pages updates correctly when setting $_GET['start'] (active page, prev and next link).
How could i tell the dataObjectSet only to display the requested number of entries per page. Is it necessary to do that manually in the foreach loop?
Hope somebody could help me and my dataObjectSet :-)
Good Night (in Germany it's time to go to bed now)