Jump to:

23489 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » pagination query result problem.

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 636 Views
  • bebabeba
    Community Member
    192 Posts

    pagination query result problem. Link to this post

    I write my query in this way.

    function Conn()
           global $db_pandora;
        $record=$db_pandora->query('SELECT * FROM mm_ville');
    { }

    $doSet = new DataObjectSet();
    foreach($rec as $key)
    $record = array(
    'Id' => $key['id'],
    'Nome' => $key['name'],
    'Descrizione' => $this->CutString($key['description'], 100),
    'Foto' => $key['filename']
    $doSet->push(new ArrayData($record));
    return $doSet;

    This show me 25 result. Now I need to divide result in 3 page (10 results every page). My problem is that in this way I create 25 page and all 25 results are repeated in all 25 page. Can you help me to solve this problem and to find my error?
    I think the problem is link to Count() function that find a big number of elemnts. Thanks!

    <% if Conn.MoreThanOnePage %>
    <div id="PageNumbers">
    <% if Conn.NotLastPage %>
    <a class="next" href="$Conn.NextLink" title="View the next page">Next</a>
    <% end_if %>
    <% if Conn.NotFirstPage %>
    <a class="prev" href="$Conn.PrevLink" title="View the previous page">Prev</a>
    <% end_if %>
    <% control Conn.Pages %>
    <% if CurrentBool %>
    <% else %>
    <a href="$Link" title="View page number $PageNum">$PageNum</a>
    <% end_if %>
    <% end_control %>
    <p>Page $Conn.CurrentPage of $Conn.TotalPages</p>
    <% end_if %>

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.