Dotclear

Changeset 2863:c14573122523


Ignore:
Timestamp:
12/20/14 15:49:27 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.7
Message:

Nb of post displayed on home page (first page) should not be applied on first pages of other contexts (tags, category, search, …) : fixed

Location:
inc/public
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inc/public/class.dc.template.php

    r2832 r2863  
    11201120               } else { 
    11211121                    // 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"; 
    11231127               } 
    11241128               // Set offset (aka index of first entry) 
    11251129               if (!isset($attr['ignore_pagination']) || $attr['ignore_pagination'] == "0") { 
    11261130                    // 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"; 
    11281136               } else { 
    11291137                    // no pagination, get all posts from 0 to limit 
  • inc/public/lib.tpl.context.php

    r2802 r2863  
    216216 
    217217          $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          } 
    219223 
    220224          return $nb_pages; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map