home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (forum-topic-list.tpl.php)

This example Drupal source code file (forum-topic-list.tpl.php) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

class, div, else, endif, foreach, if, php, table, tbody, td, thead, title, topics, tr

The forum-topic-list.tpl.php Drupal example source code

// $Id: forum-topic-list.tpl.php,v 1.10 2010/04/28 20:25:21 dries Exp $

 * @file
 * 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 template_preprocess_forum_topic_list()
 * @see theme_forum_topic_list()
<table id="forum-topic-<?php print $topic_id; ?>">
    <tr><?php print $header; ?></tr>
  <?php foreach ($topics as $topic): ?>
    <tr class="<?php print $topic->zebra;?>">
      <td class="icon"><?php print $topic->icon; ?></td>
      <td class="title">
          <?php print $topic->title; ?>
          <?php print $topic->created; ?>
    <?php if ($topic->moved): ?>
      <td colspan="3"><?php print $topic->message; ?></td>
    <?php else: ?>
      <td class="replies">
        <?php print $topic->comment_count; ?>
        <?php if ($topic->new_replies): ?>
          <br />
          <a href="<?php print $topic->new_url; ?>"><?php print $topic->new_text; ?></a>
        <?php endif; ?>
      <td class="last-reply"><?php print $topic->last_reply; ?></td>
    <?php endif; ?>
  <?php endforeach; ?>
<?php print $pager; ?>

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal forum-topic-list.tpl.php source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.