theme_forum_list
- Versions
- 4.6 – 5
theme_forum_list($forums, $parents, $tid)
Format the forum listing.
Related topics
Code
modules/forum.module, line 833
<?php
function theme_forum_list($forums, $parents, $tid) {
global $user;
if ($forums) {
$header = array(t('Forum'), t('Topics'), t('Posts'), t('Last post'));
foreach ($forums as $forum) {
if ($forum->container) {
$description = '<div style="margin-left: '. ($forum->depth * 30) ."px;\">\n";
$description .= ' <div class="name">'. l($forum->name, "forum/$forum->tid") ."</div>\n";
if ($forum->description) {
$description .= ' <div class="description">'. check_plain($forum->description) ."</div>\n";
}
$description .= "</div>\n";
$rows[] = array(array('data' => $description, 'class' => 'container', 'colspan' => '4'));
}
else {
$forum->old_topics = _forum_topics_read($forum->tid, $user->uid);
if ($user->uid) {
$new_topics = $forum->num_topics - $forum->old_topics;
}
else {
$new_topics = 0;
}
$description = '<div style="margin-left: '. ($forum->depth * 30) ."px;\">\n";
$description .= ' <div class="name">'. l($forum->name, "forum/$forum->tid") ."</div>\n";
if ($forum->description) {
$description .= ' <div class="description">'. check_plain($forum->description) ."</div>\n";
}
$description .= "</div>\n";
$rows[] = array(
array('data' => $description, 'class' => 'forum'),
array('data' => $forum->num_topics . ($new_topics ? '<br />'. l(t('%a new', array('%a' => $new_topics)), "forum/$forum->tid", NULL, NULL, 'new') : ''), 'class' => 'topics'),
array('data' => $forum->num_posts, 'class' => 'posts'),
array('data' => _forum_format($forum->last_post), 'class' => 'last-reply'));
}
}
return theme('table', $header, $rows);
}
}
?>Login or register to post comments 