Skip to content

Commit

Permalink
Add firstItem and lastItem properties/placeholders
Browse files Browse the repository at this point in the history
This will provide data for presenting the row numbers being presented on a specific page, i.e. Displaying items 5 - 10 of 12 can be written as:

Displaying items [[!+firstItem]] - [[!+lastItem]] of [[!+total]]
  • Loading branch information
opengeek committed Aug 18, 2010
1 parent f58b109 commit 3ad3c0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/components/getpage/docs/changelog.txt
Expand Up @@ -2,6 +2,7 @@ Changelog for getPage.

getPage 1.0.0-pl (August 18, 2010)
====================================
- Add firstItem and lastItem properties/placeholders
- Add pageActiveTpl to differentiate current page link

getPage 1.0.0-rc1 (June 29, 2010)
Expand Down
3 changes: 3 additions & 0 deletions core/components/getpage/snippet.getpage.php
Expand Up @@ -62,6 +62,9 @@
$qs[$properties['pageVarKey']] = $properties['page'];
}
}

$properties['firstItem'] = $properties['offset'] + 1;
$properties['lastItem'] = ($properties['offset'] + $properties['limit'] + 1) < $totalSet ? ($properties['offset'] + $properties['limit'] + 1) : $totalSet;

$properties['pageUrl'] = $modx->makeUrl($modx->resource->get('id'), '', $qs);
if ($properties['cache'] && $modx->getCacheManager()) {
Expand Down

0 comments on commit 3ad3c0d

Please sign in to comment.