Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

PaginatedList error

$
0
0

Hi, I'm having some trouble working with PaginatedLists.
I want to make my category page show 15 post in a paginatedlist but the pages must go on 5 pages step. (i.e. Page1 results: post 1-15, Page2 results: post 6-20). The first 5 results won't show the same fields of the others.
The first page is working fine, but the buttons to change pages doesn't work, when I click on it, the URL changes but the page shows the same results.

Here is my actual code:

Subcategoria.php

public function Datalist(integer $num, $start ) {
$paginatedList = new PaginatedList(Page::get());
$paginatedList->setPageLength($num)->setPageStart($start)-> where('"ParentID" = 7')->Sort("ID", "Desc");
return $paginatedList;
}

subcategoria.ss

<% loop $Datalist(5,0) %>
<a href=$link> $Title </a><br>
<% end_loop %>

---<br><br>

<% loop $Datalist(10,5) %>
<a href=$link> $Title </a><br>
<% end_loop %>

=Pagination=<br><br>

<% if $Datalist(5,0).MoreThanOnePage %>
<% if $Datalist(5,0).NotFirstPage %>
<a class="prev" href="$Datalist(5,0).PrevLink">Prev</a>
<% end_if %>
<% loop $Datalist(5,0).Pages %>
<% if $CurrentBool %>
$PageNum
<% else %>
<% if $Link %>
<a href="$Link">$PageNum</a>
<% else %>
...
<% end_if %>
<% end_if %>
<% end_loop %>
<% if $Datalist(5,0).NotLastPage %>
<a class="next" href="$Datalist(5,0).NextLink">Next</a>
<% end_if %>
<% end_if %>


Posted to: PaginatedList error | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles