root/branches/release-36/php/lib/function.mtpagerlink.php
@
2103
| Revision 2103, 0.6 kB (checked in by fumiakiy, 19 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | <?php |
| 2 | # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. |
| 3 | # This program is distributed under the terms of the |
| 4 | # GNU General Public License, version 2. |
| 5 | # |
| 6 | # $Id$ |
| 7 | |
| 8 | function smarty_function_mtpagerlink($args, &$ctx) { |
| 9 | $page = $ctx->__stash['vars']['__value__']; |
| 10 | if ( !$page ) return ''; |
| 11 | |
| 12 | $limit = $ctx->stash('__pager_limit'); |
| 13 | $offset = ( $page - 1 ) * $limit; |
| 14 | |
| 15 | if ( strpos($link, '?') ) { |
| 16 | $link .= '&'; |
| 17 | } |
| 18 | else { |
| 19 | $link .= '?'; |
| 20 | } |
| 21 | |
| 22 | $link .= "limit=$limit"; |
| 23 | if ( $offset ) |
| 24 | $link .= "&offset=$offset"; |
| 25 | return $link; |
| 26 | } |
| 27 | ?> |
| 28 |
Note: See TracBrowser
for help on using the browser.
