Note that there are some explanatory texts on larger screens.

plurals
  1. POZend Paginator: Show pagination links without loading(NON-DB) data
    primarykey
    data
    text
    <p>I am using a service which fetches results and total number of results present for the filters in one shot. Elaborating more, suppose there are total 100,000 records and I am showing 25 records on one page. I have an array having:</p> <pre><code>$myarr = array('totalCount' =&gt; 100000, 'results' =&gt; array(...data...)); </code></pre> <p>This data is limited to 25 records in one go. </p> <p>PROBLEM : When sending this data to zend_paginator it's showing only 1 page(anchor) with prev[disabled] &amp; next[disabled]. According to code its working fine but how to show other paginating anchors[2,3,4,5,6,7,8,9] etc. as I know total counts of data.</p> <p>I researched long for this but every where solutions are for DB queries and I don't get this result from DB, its from a service resulting in XML format which is converted to an array.</p> <pre><code>$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($myarr ['results'])); $paginator-&gt;setItemCountPerPage(25); $paginator-&gt;setPageRange(10); $paginator-&gt;setCurrentPageNumber(1); </code></pre> <p>How can I send total count so that it creates other paginating links without loading all data as I received a Memory Exhaust fatal error because of loading 100,000 records &amp; it also looks unoptimized way of fetching all records every time for showing just 25 records when I have TOTAL COUNT in every service request.</p> <p>pagination.phtml:</p> <pre><code>&lt;div class="pagination" &gt; &lt;!-- Previous page link --&gt; &lt;?php if (isset($this-&gt;previous)): ?&gt; &lt;a href="javascript:void(0)" onclick='fetchPaginationData("&lt;?php echo $this-&gt;divid;?&gt;","&lt;?php echo $this-&gt;url(array('page' =&gt; $this-&gt;firstPageInRange -1)); ?&gt;")'&gt;&lt;span style="border-bottom-left-radius: 4px; border-left-width: 1px; border-top-left-radius: 4px;"&gt;Prev&lt;/span&gt;&lt;/a&gt; &lt;?php else: ?&gt; &lt;span class="disabled" style="border-bottom-left-radius: 4px; border-left-width: 1px; border-top-left-radius: 4px;"&gt;Prev&lt;/span&gt; &lt;?php endif; ?&gt; &lt;!-- Numbered page links --&gt; &lt;?php foreach ($this-&gt;pagesInRange as $page): ?&gt; &lt;?php if ($page != $this-&gt;current): ?&gt; &lt;a href="javascript:void(0);" onclick='fetchPaginationData("&lt;?php echo $this-&gt;divid;?&gt;","&lt;?php echo $this-&gt;url(array('page' =&gt; $page)); ?&gt;")' &gt;&lt;span&gt;&lt;?php echo $page; ?&gt;&lt;/span&gt;&lt;/a&gt; &lt;?php else: ?&gt; &lt;span class="page_current"&gt;&lt;?php echo $page; ?&gt;&lt;/span&gt; &lt;?php endif; ?&gt; &lt;?php endforeach; ?&gt; &lt;!-- Next page link --&gt; &lt;?php if (isset($this-&gt;next)): ?&gt; &lt;a href="javascript:void(0);" onclick='fetchPaginationData("&lt;?php echo $this-&gt;divid;?&gt;","&lt;?php echo $this-&gt;url(array('page' =&gt; $this-&gt;lastPageInRange +1)); ?&gt;")'&gt;&lt;span&gt;Next &amp;gt;&lt;/span&gt;&lt;/a&gt; &lt;?php else: ?&gt; &lt;span class="disabled" style="border-bottom-right-radius: 4px; border-top-right-radius: 4px;"&gt;Next&lt;/span&gt; &lt;?php endif; ?&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload