Skip navigation
Help

forum-topic-list.tpl.php

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

Default theme implementation to display a list of forum topics.

Available variables:

  • $header: The table header. This is pre-generated with click-sorting information. If you need to change this, see template_preprocess_forum_topic_list().
  • $pager: The pager to display beneath the table.
  • $topics: An array of topics to be displayed.
  • $topic_id: Numeric id for the current forum topic.

Each $topic in $topics contains:

  • $topic->icon: The icon to display.
  • $topic->moved: A flag to indicate whether the topic has been moved to another forum.
  • $topic->title: The title of the topic. Safe to output.
  • $topic->message: If the topic has been moved, this contains an explanation and a link.
  • $topic->zebra: 'even' or 'odd' string used for row class.
  • $topic->comment_count: The number of replies on this topic.
  • $topic->new_replies: A flag to indicate whether there are unread comments.
  • $topic->new_url: If there are unread replies, this is a link to them.
  • $topic->new_text: Text containing the translated, properly pluralized count.
  • $topic->created: An outputtable string represented when the topic was posted.
  • $topic->last_reply: An outputtable string representing when the topic was last replied to.
  • $topic->timestamp: The raw timestamp this topic was posted.

See also

template_preprocess_forum_topic_list()

theme_forum_topic_list()

1 theme call to forum-topic-list.tpl.php

File

drupal/modules/forum/forum-topic-list.tpl.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Default theme implementation to display a list of forum topics.
  5. *
  6. * Available variables:
  7. * - $header: The table header. This is pre-generated with click-sorting
  8. * information. If you need to change this, see
  9. * template_preprocess_forum_topic_list().
  10. * - $pager: The pager to display beneath the table.
  11. * - $topics: An array of topics to be displayed.
  12. * - $topic_id: Numeric id for the current forum topic.
  13. *
  14. * Each $topic in $topics contains:
  15. * - $topic->icon: The icon to display.
  16. * - $topic->moved: A flag to indicate whether the topic has been moved to
  17. * another forum.
  18. * - $topic->title: The title of the topic. Safe to output.
  19. * - $topic->message: If the topic has been moved, this contains an
  20. * explanation and a link.
  21. * - $topic->zebra: 'even' or 'odd' string used for row class.
  22. * - $topic->comment_count: The number of replies on this topic.
  23. * - $topic->new_replies: A flag to indicate whether there are unread comments.
  24. * - $topic->new_url: If there are unread replies, this is a link to them.
  25. * - $topic->new_text: Text containing the translated, properly pluralized count.
  26. * - $topic->created: An outputtable string represented when the topic was posted.
  27. * - $topic->last_reply: An outputtable string representing when the topic was
  28. * last replied to.
  29. * - $topic->timestamp: The raw timestamp this topic was posted.
  30. *
  31. * @see template_preprocess_forum_topic_list()
  32. * @see theme_forum_topic_list()
  33. */
  34. ?>
  35. <table id="forum-topic-<?php print $topic_id; ?>">
  36. <thead>
  37. <tr><?php print $header; ?></tr>
  38. </thead>
  39. <tbody>
  40. <?php foreach ($topics as $topic): ?>
  41. <tr class="<?php print $topic->zebra;?>">
  42. <td class="icon"><?php print $topic->icon; ?></td>
  43. <td class="title">
  44. <div>
  45. <?php print $topic->title; ?>
  46. </div>
  47. <div>
  48. <?php print $topic->created; ?>
  49. </div>
  50. </td>
  51. <?php if ($topic->moved): ?>
  52. <td colspan="3"><?php print $topic->message; ?></td>
  53. <?php else: ?>
  54. <td class="replies">
  55. <?php print $topic->comment_count; ?>
  56. <?php if ($topic->new_replies): ?>
  57. <br />
  58. <a href="<?php print $topic->new_url; ?>"><?php print $topic->new_text; ?></a>
  59. <?php endif; ?>
  60. </td>
  61. <td class="last-reply"><?php print $topic->last_reply; ?></td>
  62. <?php endif; ?>
  63. </tr>
  64. <?php endforeach; ?>
  65. </tbody>
  66. </table>
  67. <?php print $pager; ?>