Here is a PHx modificator to make a Ditto pagination (as davidm wish

). Useful if you are useing PHx on your site.
This modificator is using a very big part of SplitPagination snippet code.
Create file in assets\plugins\phx\modifiers with the name dittopages.phx.php and copy code
<?php
list($id, $total, $summarize) = explode(",", str_replace(" ","", $options));
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;
}
}
$id = $id ? $id."_" : "";
$landing = $modx->documentObject['id'];
if ($total == 0 || $summarize==0) {
return false;
}
$page = ($start/$summarize)+1;
$paginationArray = generatePagination($page, $total, $summarize);
$ph = "";
$cInc = $_GET[$id.'start'];
foreach($paginationArray as $page) {
$inc = ($page-1)*$summarize;
if($page == 0) {
$ph .= "..."; // print an elipse, representing pages that aren't displayed
} else if ($inc==$cInc) {
$ph .= "<span class=\"ditto_currentpage\">$page</span>";
} else {
$ph .= "<a class=\"ditto_page\" href='".ditto::buildURL("start=".$inc,$landing,$id)."'>$page</a>";
}
}
return $ph;
?>
Using on the page - insert after Ditto call
Ditto call w/o &id: [+phx:dittopages=`,[+total+],[+perPage+]`+]
If you are using id parameter in the ditto call like [[Ditto? ... &id=’myid’ ]]
Ditto call with &id=`myid`: [+phx:dittopages=`myid,[+myid_total+],[+myid_perPage+]`+]