This function retrieve value like findAll function but it create a pagination based on a limit
App::CategorySet(NAME)->Listing(OPTION);
OPTIONS
Option is an array with LIMIT and flag.
•In LIMIT is list per page
• Flag is short, long
For example:
$data = App::CategorySet('blog-cat')
->Listing(
array(
'limit'=>1,
'flag'=>'short'
)
);
//Return value
/*Array
(
[data] => Array
(
[1] => Page Manager
)
[paging] => <a href="?&page=2" class="page_next" title="Next">Next</a>
[link] => Showing Results 1-1 of 2
[total] => 2
[page] => 1
[paging_str] => <div class="pagination pagination-left">
<div class="results">
<span>Showing Results 1-1 of 2</span>
</div>
<ul class="pager">
<li class="disabled">Previous</li>
<li class="current">1</li><li><a href="?&page=2">2</a> </li>
<li><a href="?&page=2" class="page_next" title="Next">Next</a></li>
</ul>
</div>
)*/
$data = App::CategorySet('blog-cat')
->Listing(
array(
'limit'=>1,
'flag'=>'long' // Or We can left it empty
)
);
// Return value
/*Array
(
[data] => Array
(
[0] => Array
(
[id] => 1
[fkey] => 0
[adminref] => 1
[parentid] => 0
[image] =>
[title] => Page Manager
[description] =>
[type] => blog-cat
[generic] =>
[entrydate] => 2012-12-13 10:47:18
[lastmodified] => 2012-12-13 10:47:18
)
)
[paging] => <a href="?&page=2" class="page_next" title="Next">Next</a>
[link] => Showing Results 1-1 of 2
[total] => 2
[page] => 1
[paging_str] => <div class="pagination pagination-left">
<div class="results">
<span>Showing Results 1-1 of 2</span>
</div>
<ul class="pager">
<li class="disabled">Previous</li>
<li class="current">1</li><li><a href="?&page=2">2</a> </li>
<li><a href="?&page=2" class="page_next" title="Next">Next</a></li>
</ul>
</div>
)
*/