$output = $modx->runSnippet('getPage', array( 'elementClass' => 'modSnippet', 'element' => 'getResources', 'parents' => $sid, 'limit' => 5, 'depth' => 1, 'pageVarKey' => 'page', 'totalVar' => 'total', 'offset' => 5, 'tpl' => 'tpl-Under-Side-Liste-Item', 'showHidden' => 1, 'pageFirstTpl' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Første</a></li>', 'pageLastTpl' => '<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Siste</a></li>', 'pageNavOuterTpl' => '[[+prev]][[+pages]][[+next]]', 'pageActiveTpl' => '<li[[+activeClasses]]>[[+pageNo]]</li>', 'includeTVs' => 1 ));
How could I then trim away five results so that it will show all the other resources?You would need to exclude them from the total via where conditions for getResources or something, or we would need to add an initial offset feature to getPage so it could handle the calculations differently.
$properties['offset'] = (!empty($properties['limit']) && !empty($properties['page'])) ? ($properties['limit'] * ($properties['page'] - 1)) + 1 : 0;
$properties['offset'] = (!empty($properties['limit']) && !empty($properties['page'])) ? ($properties['limit'] * ($properties['page'] - 1)) + $initialOffset : 0;
$initialOffset=`1`
@michelle84, I combined your solution and Jason's - changed that line to:
$properties['offset'] = (!empty($properties['limit']) && !empty($properties['page'])) ? ($properties['limit'] * ($properties['page'] - 1)) + $initialOffset : 0;
and then included this in my getPage call:
$initialOffset=`1`
This allows you to customize the offset per call instead of hard coding it into the snippet. I don't see any reason why this couldn't VERY easily have been added to getPage by now - Jason?