pagination is very critical instrument in catalogue creation, but with pagination and phx ditto can work only on uncashed page
such page loading slowly and heavily loads server processor
what can be done, is there any cahcing mechanisms maybe?
then call that particular Ditto region (see id parameter) and corresponding MySplitPages uncached, everything else stays cached.
i’m using splitpagination, but it’s not working on cashed page too, What particular Ditto region i need to call, can you be more specific?
<?php //only for forum highlighting // Place immediately following a Ditto call // Based on the function written by Aaron Hall, evilwalrus.org // Ditto 2.1 start page fix & PHx workaround: Eol ([email protected]) if (!function_exists("generatePagination")) { function generatePagination($curPage, $totResults, $resultsPerPage) { $totPages = ceil($totResults / $resultsPerPage); $pagesBefore = $curPage - 1; $pagesAfter = $totPages - $curPage; $tabArr = array(); if ($totPages > 15) { if ($pagesBefore > 7) { $tabArr = array(1, 2, 0); if ($pagesAfter > 7) { for ($i=($curPage-4); $i<$curPage; $i++) { $tabArr[] = $i; } } else { for ($i=($totPages-11); $i<$curPage; $i++) { $tabArr[] = $i; } } } else { for ($i=1; $i<$curPage; $i++) { $tabArr[] = $i; } } $tabArr[] = $curPage; if ($pagesAfter > 7) { if ($pagesBefore > 7) { for ($i=($curPage+1); $i<=$curPage+4; $i++) { $tabArr[] = $i; } } else { for ($i=($curPage+1); $i<13; $i++) { $tabArr[] = $i; } } $tabArr[] = 0; $tabArr[] = $totPages-1; $tabArr[] = $totPages; } else { for ($i=($curPage+1); $i<=$totPages; $i++) { $tabArr[] = $i; } } } else { for ($i=1; $i<=$totPages; $i++) { $tabArr[] = $i; } } return $tabArr; }//function generatePagination end } $id = isset($id) ? $id.'_' : ''; $total = isset($total) ? $total : $modx->getPlaceholder($id."total"); $start = isset($start) ? $start : $modx->getPlaceholder($id."urlStart"); $summarize = isset($summarize) ? $summarize : $modx->getPlaceholder($id."perPage"); $currentPage = isset($currentPage) ? $currentPage : $modx->getPlaceholder($id."current"); $landing = isset($tagDocumentID) ? $tagDocumentID : $modx->documentObject['id']; if ($total == 0 || $summarize == 0) { return false; } $page = ($start/$summarize)+1; $output = isset($output) ? $output : 0; $paginationArray = generatePagination($page, $total, $summarize); $ph = ""; $cInc = $_GET[$id.'start']; foreach ($paginationArray as $page) { $inc = ($page-1) * $summarize; if ($page == 0) { $ph .= "..."; // represents pages that aren't displayed } else if ($inc == $cInc) { $ph .= "<span class=\"active\">{$page}</span>"; } else { $ph .= "<a class=\"page\" href=\"".ditto::buildURL("start=".$inc, $landing, $id)."\">{$page}</a>\n"; } } $modx->setPlaceholder("{$id}pagesplit", $ph); if ($output) { return " <div class=\"pages\"> <strong>[+{$id}start+]</strong>-<strong>[+{$id}stop+]</strong> od <strong>[+{$id}total+]</strong> [+{$id}previous+] {$ph} [+{$id}next+] </div>"; }
but if catalogue is big enought it needs 2 paging calls
before and after
can i accomplish this with your method?
I’m getting pagination like 1 2 ... 1 2 3 4 5 6 7 8 ... 10 11 12
1+2 gets repeated when I clicked 5.