Настройка форума

Главные вкладки

Комментарии

Аватар пользователя Shedko Shedko 1 ноября 2006 в 0:39

А что конкретно из этого форума надо ?

Или писать о бо всем ?

В ядре и в модулях ничего не менял, так что это безопасная кустомизация. Все делается через файлы темы.

Аватар пользователя Shedko Shedko 1 ноября 2006 в 2:58

в наш template.php добавляем

function THEMENAME_forum_topic_list($tid, $topics, $sortby, $forum_per_page) {
  global $forum_topic_list_header;
  global $id;
    if ($topics) {
    foreach ($topics as $topic) {
      // folder is new if topic is new or there are new comments since last visit
      if ($topic->tid != $tid) {
        $rows[] = array(
          array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
          array('data' => check_plain($topic->title), 'class' => 'title'),
          array('data' => l(t('This topic has been moved'), "forum/$topic->tid"), 'colspan' => '3')
        );
      }
      else {
        if ( user_access('view post access counter')) {
                                $statistics = statistics_get($topic->nid);
                                if ($statistics) {
                                        $description2 = format_plural($statistics['totalcount'], '1 read', '%count reads');
                }}
        $rows[] = array(
          array('data' => theme('forum_icon', $topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
          array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
          array('data' => $topic->num_comments . ($topic->new_replies ? '<br />'. l(format_plural($topic->new_replies, '1 new', '%count new'), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'),
          array('data' => _forum_format($topic), 'class' => 'created'),
          array('data' => _forum_format($topic->last_reply), 'class' => 'last-reply'),
          array('data' => $description2 )
        );
      }
    }
  }
         $forum_topic_list_header = array(
    array('data' => '&nbsp;'),
    array('data' => t('Topic'), 'field' => 'n.title'),
    array('data' => t('Replies'), 'field' => 'l.comment_count'),
    array('data' => t('Created'), 'field' => 'n.created'),
    array('data' => t('Last reply'), 'field' => 'l.last_comment_timestamp'),
    array('data' => t('Reads'), 'field' => 'n.views'),
  );
  $output .= theme('table', $forum_topic_list_header, $rows);
  $output .= theme('pager', NULL, $forum_per_page, 0);
  return $output;
}

Т.е. в начало процедуры добавляем

global $id;

а также в кусок

         $forum_topic_list_header = array(
    array('data' => '&nbsp;'),
    array('data' => t('Topic'), 'field' => 'n.title'),
    array('data' => t('Replies'), 'field' => 'l.comment_count'),
    array('data' => t('Created'), 'field' => 'n.created'),
    array('data' => t('Last reply'), 'field' => 'l.last_comment_timestamp'),
  );

добавляем еще одну строчку:

array('data' => t('Reads'), 'field' => 'n.views'),

т.е. должно получиться:

         $forum_topic_list_header = array(
    array('data' => '&nbsp;'),
    array('data' => t('Topic'), 'field' => 'n.title'),
    array('data' => t('Replies'), 'field' => 'l.comment_count'),
    array('data' => t('Created'), 'field' => 'n.created'),
    array('data' => t('Last reply'), 'field' => 'l.last_comment_timestamp'),
    array('data' => t('Reads'), 'field' => 'n.views'),
  );

Но на данный момент не разобрался с сортировкой этого столбца, ибо процедура сортировки не является theme_функцией, а обычные функции, пока не совсем понял как заменять на свои.