The code added to your template.php file when using the phptemplate engine will get the forum looking more like a real forum.
The Drupal default forum is not very user friendly the layout used here is designed after punBB forum to be clean, fast and with high usability.
The script can be used in Drupal version 4.6 and 4.7 PHPtemplate. The moderation links shown in the picture are not part of this template.
<?php
/**
* Format the forum listing.
*
* @ingroup themeable
*/
function phptemplate_forum_list($forums, $parents, $tid) {
global $user;
if ($forums) {
//$header = array(t('Forum'), t('Topics'), t('Posts'), t('Last post'));
//$header = array();
foreach ($forums as $key=>$forum) {
if ($forum->container) {
$description = '<div style="margin-left: '. ($forum->depth * 30) ."px;\">\n";
$description .= ' <div class="name">'. l($forum->name, "forum/$forum->tid/container") ."</div>\n";
if ($forum->description) {
$description .= " <div class=\"description\">$forum->description</div>\n";
}
$description .= "</div>\n";
$rows[] = array(array('data' => $description, 'class' => 'container', 'colspan' => 4));
$rows[] = array(
array('data' => t('Subject'), 'class' => 'f-subject'),
array('data' => t('Topics'), 'class' => 'f-topics'),
array('data' => t('Posts'),'class' => 'f-posts'),
array('data' => t('Last post'),'class' => 'f-last-reply')
);
}
else {
$forum->old_topics = _forum_topics_unread($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\">$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'));
}
}
/**
* set table header if page is a container with listing of forums
*/
if(in_array(arg(1), variable_get('forum_containers', array()))){
// reverse array
$nrows = array_reverse($rows,true);
//get the container description
$container = taxonomy_get_term(arg(1));
//add to output
$rows = $nrows;
$rows[] = array(
array('data' => t('Subject'), 'class' => 'f-subject'),
array('data' => t('Topics'), 'class' => 'f-topics'),
array('data' => t('Posts'),'class' => 'f-posts'),
array('data' => t('Last post'),'class' => 'f-last-reply')
);
$rows[] = array(array('data' => $container->description, 'class' => 'container', 'colspan' => 4));
//reverse again to output
$nrows = array_reverse($rows,true);
$rows = $nrows;
}
return theme('table', $header, $rows);
}
}
?>