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

Displays a list of forums and containers.

Available variables:

  • $forums: An array of forums and containers to display. It is keyed to the numeric IDs of all child forums and containers. Each $forum in $forums contains:

    • $forum->is_container: TRUE if the forum can contain other forums. 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->icon_class: 'default' or 'new' string used for forum icon class.
    • $forum->icon_title: Text alternative for the forum icon.
    • $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.
  • $forum_id: Forum ID for the current forum. Parent to all items within the $forums array.

See also

template_preprocess_forum_list()

theme_forum_list()

1 theme call to forum-list.tpl.php
template_preprocess_forums in modules/forum/forum.module
Preprocesses variables for forums.tpl.php.

File

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

Related topics