Changeset 2863:c14573122523
- Timestamp:
- 12/20/14 15:49:27 (9 years ago)
- Branch:
- 2.7
- Location:
- inc/public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/public/class.dc.template.php
r2832 r2863 1120 1120 } else { 1121 1121 // nb of entries per page not specified -> use ctx settings 1122 $p .= "\$params['limit'] = (\$_page_number == 1 ? \$_ctx->nb_entry_first_page : \$_ctx->nb_entry_per_page);\n"; 1122 $p .= "if ((\$core->url->type == 'default') || (\$core->url->type == 'default-page')) {\n"; 1123 $p .= " \$params['limit'] = (\$_page_number == 1 ? \$_ctx->nb_entry_first_page : \$_ctx->nb_entry_per_page);\n"; 1124 $p .= "} else {\n"; 1125 $p .= " \$params['limit'] = \$_ctx->nb_entry_per_page;\n"; 1126 $p .= "}\n"; 1123 1127 } 1124 1128 // Set offset (aka index of first entry) 1125 1129 if (!isset($attr['ignore_pagination']) || $attr['ignore_pagination'] == "0") { 1126 1130 // standard pagination, set offset 1127 $p .= "\$params['limit'] = array((\$_page_number == 1 ? 0 : (\$_page_number - 2) * \$_ctx->nb_entry_per_page + \$_ctx->nb_entry_first_page),\$params['limit']);\n"; 1131 $p .= "if ((\$core->url->type == 'default') || (\$core->url->type == 'default-page')) {\n"; 1132 $p .= " \$params['limit'] = array((\$_page_number == 1 ? 0 : (\$_page_number - 2) * \$_ctx->nb_entry_per_page + \$_ctx->nb_entry_first_page),\$params['limit']);\n"; 1133 $p .= "} else {\n"; 1134 $p .= " \$params['limit'] = array((\$_page_number - 1) * \$_ctx->nb_entry_per_page,\$params['limit']);\n"; 1135 $p .= "}\n"; 1128 1136 } else { 1129 1137 // no pagination, get all posts from 0 to limit -
inc/public/lib.tpl.context.php
r2802 r2863 216 216 217 217 $nb_posts = $_ctx->pagination->f(0); 218 $nb_pages = ceil(($nb_posts - $_ctx->nb_entry_first_page) / $_ctx->nb_entry_per_page + 1); 218 if (($GLOBALS['core']->url->type == 'default') || ($GLOBALS['core']->url->type == 'default-page')) { 219 $nb_pages = ceil(($nb_posts - $_ctx->nb_entry_first_page) / $_ctx->nb_entry_per_page + 1); 220 } else { 221 $nb_pages = ceil($nb_posts / $_ctx->nb_entry_per_page); 222 } 219 223 220 224 return $nb_pages;
Note: See TracChangeset
for help on using the changeset viewer.