Changeset 19303


Ignore:
Timestamp:
Dec 6, 2012, 3:19:12 PM (8 years ago)
Author:
plg
Message:

feature 2798: let the webmaster decide how many comments to display on
comments.php by default

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/comments.php

    r18995 r19303  
    5252// items_number : list of number of items to display per page
    5353$items_number = array(5,10,20,50,'all');
     54
     55// if the default value is not in the expected values, we add it in the $items_number array
     56if (!in_array($conf['comments_page_nb_comments'], $items_number))
     57{
     58  $items_number_new = array();
     59
     60  $is_inserted = false;
     61
     62  foreach ($items_number as $number)
     63  {
     64    if ($number > $conf['comments_page_nb_comments'] or ($number == 'all' and !$is_inserted))
     65    {
     66      $items_number_new[] = $conf['comments_page_nb_comments'];
     67      $is_inserted = true;
     68    }
     69   
     70    $items_number_new[] = $number;
     71  }
     72
     73  $items_number = $items_number_new;
     74}
    5475
    5576// since when display comments ?
     
    97118// number of items to display
    98119//
    99 $page['items_number'] = 10;
     120$page['items_number'] = $conf['comments_page_nb_comments'];
    100121if (isset($_GET['items_number']))
    101122{
  • trunk/include/config_default.inc.php

    r18889 r19303  
    299299// you can define imagemagick directory.
    300300$conf['ext_imagick_dir'] = '';
     301
     302// how many user comments to display by default on comments.php. Use 'all'
     303// to display all user comments without pagination. Default available values
     304// are array(5,10,20,50,'all') but you can set any other numeric value.
     305$conf['comments_page_nb_comments'] = 10;
    301306
    302307// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.