Changeset 2577:9a2b43a68e3d for inc/public/class.dc.template.php
- Timestamp:
- 11/21/13 15:11:09 (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/public/class.dc.template.php
r2574 r2577 1042 1042 1043 1043 if ($lastn != 0) { 1044 // Set limit (aka nb of entries needed) 1044 1045 if ($lastn > 0) { 1046 // nb of entries per page specified in template -> regular pagination 1045 1047 $p .= "\$params['limit'] = ".$lastn.";\n"; 1046 1048 } else { 1047 $p .= "\$params['limit'] = \$_ctx->nb_entry_per_page;\n"; 1049 // nb of entries per page not specified -> use ctx settings 1050 $p .= "\$params['limit'] = (\$_page_number == 1 ? \$_ctx->nb_entry_first_page : \$_ctx->nb_entry_per_page);\n"; 1048 1051 } 1049 1052 // Set offset (aka index of first entry) 1050 1053 if (!isset($attr['ignore_pagination']) || $attr['ignore_pagination'] == "0") { 1051 $p .= "\$params['limit'] = array(((\$_page_number-1)*\$params['limit']),\$params['limit']);\n"; 1054 // standard pagination, set offset 1055 $p .= "\$params['limit'] = array((\$_page_number == 1 ? 0 : (\$_page_number - 2) * \$_ctx->nb_entry_per_page + \$_ctx->nb_entry_first_page),\$params['limit']);\n"; 1052 1056 } else { 1057 // no pagination, get all posts from 0 to limit 1053 1058 $p .= "\$params['limit'] = array(0, \$params['limit']);\n"; 1054 1059 }
Note: See TracChangeset
for help on using the changeset viewer.