Skip navigation
Help

forum-list.tpl.php

  1. drupal
    1. 6 drupal/modules/forum/forum-list.tpl.php
    2. 7 drupal/modules/forum/forum-list.tpl.php

Default theme implementation to display a list of forums and containers.

Available variables:

  • $forums: An array of forums and containers to display. It is keyed to the numeric id's of all child forums and containers.
  • $forum_id: Forum id for the current forum. Parent to all items within the $forums array.

Each $forum in $forums contains:

  • $forum->is_container: Is TRUE if the forum can contain other forums. Is FALSE if the forum can contain only topics.
  • $forum->depth: How deep the forum is in the current hierarchy.
  • $forum->zebra: 'even' or 'odd' string used for row class.
  • $forum->name: The name of the forum.
  • $forum->link: The URL to link to this forum.
  • $forum->description: The description of this forum.
  • $forum->new_topics: True if the forum contains unread posts.
  • $forum->new_url: A URL to the forum's unread posts.
  • $forum->new_text: Text for the above URL which tells how many new posts.
  • $forum->old_topics: A count of posts that have already been read.
  • $forum->num_posts: The total number of posts in the forum.
  • $forum->last_reply: Text representing the last time a forum was posted or commented in.

See also

template_preprocess_forum_list()

theme_forum_list()

1 theme call to forum-list.tpl.php

File

drupal/modules/forum/forum-list.tpl.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Default theme implementation to display a list of forums and containers.
  5. *
  6. * Available variables:
  7. * - $forums: An array of forums and containers to display. It is keyed to the
  8. * numeric id's of all child forums and containers.
  9. * - $forum_id: Forum id for the current forum. Parent to all items within
  10. * the $forums array.
  11. *
  12. * Each $forum in $forums contains:
  13. * - $forum->is_container: Is TRUE if the forum can contain other forums. Is
  14. * FALSE if the forum can contain only topics.
  15. * - $forum->depth: How deep the forum is in the current hierarchy.
  16. * - $forum->zebra: 'even' or 'odd' string used for row class.
  17. * - $forum->name: The name of the forum.
  18. * - $forum->link: The URL to link to this forum.
  19. * - $forum->description: The description of this forum.
  20. * - $forum->new_topics: True if the forum contains unread posts.
  21. * - $forum->new_url: A URL to the forum's unread posts.
  22. * - $forum->new_text: Text for the above URL which tells how many new posts.
  23. * - $forum->old_topics: A count of posts that have already been read.
  24. * - $forum->num_posts: The total number of posts in the forum.
  25. * - $forum->last_reply: Text representing the last time a forum was posted or
  26. * commented in.
  27. *
  28. * @see template_preprocess_forum_list()
  29. * @see theme_forum_list()
  30. */
  31. ?>
  32. <table id="forum-<?php print $forum_id; ?>">
  33. <thead>
  34. <tr>
  35. <th><?php print t('Forum'); ?></th>
  36. <th><?php print t('Topics');?></th>
  37. <th><?php print t('Posts'); ?></th>
  38. <th><?php print t('Last post'); ?></th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. <?php foreach ($forums as $child_id => $forum): ?>
  43. <tr id="forum-list-<?php print $child_id; ?>" class="<?php print $forum->zebra; ?>">
  44. <td <?php print $forum->is_container ? 'colspan="4" class="container"' : 'class="forum"'; ?>>
  45. <?php /* Enclose the contents of this cell with X divs, where X is the
  46. * depth this forum resides at. This will allow us to use CSS
  47. * left-margin for indenting.
  48. */ ?>
  49. <?php print str_repeat('<div class="indent">', $forum->depth); ?>
  50. <div class="name"><a href="<?php print $forum->link; ?>"><?php print $forum->name; ?></a></div>
  51. <?php if ($forum->description): ?>
  52. <div class="description"><?php print $forum->description; ?></div>
  53. <?php endif; ?>
  54. <?php print str_repeat('</div>', $forum->depth); ?>
  55. </td>
  56. <?php if (!$forum->is_container): ?>
  57. <td class="topics">
  58. <?php print $forum->num_topics ?>
  59. <?php if ($forum->new_topics): ?>
  60. <br />
  61. <a href="<?php print $forum->new_url; ?>"><?php print $forum->new_text; ?></a>
  62. <?php endif; ?>
  63. </td>
  64. <td class="posts"><?php print $forum->num_posts ?></td>
  65. <td class="last-reply"><?php print $forum->last_reply ?></td>
  66. <?php endif; ?>
  67. </tr>
  68. <?php endforeach; ?>
  69. </tbody>
  70. </table>