Location: PHPKode > projects > WH Community > wh_community/top_topics.php
<?php require('layout/header.php'); ?>

<div id="content_wrapper">
    <div class="content"><?php

        echo '<h1>' . $lang['top_topics'] . '</h1><br>';

		$sql = "SELECT
					topics.topic_id,
					topics.topic_subject,
					topics.topic_date,
					topics.topic_cat,
					topics.topic_by,
					COUNT(posts.post_id) AS posts,
					categories.cat_id,
					categories.cat_name,
					users.user_id,
					users.user_name
				FROM
					topics
				LEFT JOIN
					posts
				ON
					posts.post_id = topics.topic_id
				LEFT JOIN
					categories
				ON
				    topics.topic_cat = categories.cat_id
				LEFT JOIN
					users
				ON
				    topics.topic_by = users.user_id
				GROUP BY
					topics.topic_subject, topics.topic_cat, topics.topic_id
				ORDER BY
					topics.topic_id ASC
                LIMIT
                    10";

		$result = mysql_query($sql) OR die(mysql_error());
		
		if(!$result) {

		echo '<p class="false">' . $lang['no_topic'] . '.</p>';

			}else{

			if(intval(mysql_num_rows($result)) == 0) {

			echo '<p class="false">' . $lang['no_topic'] . '.</p>';

		}else{

		while($row = mysql_fetch_assoc($result)) {
            
            echo '<table width="100%" cellpadding="3" class="topstable">
                  <tr>
                  <td height="40"><a href="topic.php?id=' . (int)$row['topic_id'] . '" class="toplinks">' . htmlentities($row['topic_subject'], ENT_QUOTES) . '</a></td>
                  </tr>
                  <tr>
                  <td><small><strong>' . $lang['category'] . ':</strong> ' . htmlentities($row['cat_name'], ENT_QUOTES) . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>' . $lang['author'] . ':</strong> ' . htmlentities($row['user_name'], ENT_QUOTES) . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>' . $lang['on_b'] . ':</strong> <em>'; 
                  
                  if($language == "de") {
                      echo date('d.m.Y - H:i', strtotime($row['topic_date']));

                  }elseif($language == "en") {
                      echo date('Y-m-d - H:i', strtotime($row['topic_date'])); }
                  
            echo ' ' . $lang['o_clock'] . '</em></small></td>
                  </tr>
                  </table>';
        
        }}}
		
		echo '<div class="spacer_div">&nbsp;</div>';

		?>
	</div>
</div>

<div id="infobox_wrapper">
    <div class="infobox">
        <?php include('layout/infobox.php'); ?>
    </div>
</div>

<?php require('layout/footer.php'); ?>
Return current item: WH Community