[BETA] Last 5 on Index 1.0.0 แสดง 5 กระทู้ใหม่ 5 user ใหม่

แนะนำ Mod ต่างๆ ของ PHPBB3 แนะนำความสามารถ ของ mod การติดตั้ง การเข้ากันได้กับเวอร์ชั่น

Moderator: mindphp

ภาพประจำตัวสมาชิก
M004
PHP VIP Members
PHP VIP Members
โพสต์: 1323
ลงทะเบียนเมื่อ: 01/01/1970 7:00 am

[BETA] Last 5 on Index 1.0.0 แสดง 5 กระทู้ใหม่ 5 user ใหม่

โพสต์ที่ยังไม่ได้อ่าน โดย M004 »

รายละเอียดเกี่ยวกับ [BETA] Last 5 on Index 1.0.0 แสดง 5 กระทู้ใหม่ 5 user ใหม่

พัฒนาโดย : Kamahl
Version : 1.0.0
phpBB Version(s) : phpBB 3.0.11
ดาวน์โหลดได้ที่ : https://www.phpbb.com/community/viewtop ... t=2167015l
1.png
1.png (38.19 KiB) Viewed 1078 times
เปิดไฟล์ index.php
ค้นหา

โค้ด: เลือกทั้งหมด

// Output page
เติมก่อน

โค้ด: เลือกทั้งหมด

$sql = "SELECT p.post_id, p.poster_id, p.post_time, u.username, u.user_colour, t.topic_title
              FROM " . POSTS_TABLE . " AS p
                    LEFT JOIN " . USERS_TABLE . " AS u
                      ON p.poster_id = u.user_id
          LEFT JOIN " . TOPICS_TABLE . " AS t
                      ON p.topic_id = t.topic_id
              WHERE p.post_approved = 1
              ORDER BY p.post_time DESC";
$result = $db->sql_query_limit($sql, 5, 0, 60);

while ($row = $db->sql_fetchrow($result))
{
  $template->assign_block_vars('top_posts', array(
        'PROFILE'         => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']),
        'DATE'                => $user->format_date($row['post_time']),
        'TOPIC_TITLE' => $row['topic_title'],
        'POST_URL'         => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p='.$row["post_id"].'#p'.$row["post_id"]),
    ));
}
$db->sql_freeresult($result);

$template->assign_vars(array(
  'L_FROM_TOP'    => ucfirst($user->lang['FROM']),
));

$sql = "SELECT username, user_id, user_colour, user_posts
              FROM " . USERS_TABLE . "
              WHERE user_id <> " . (int) ANONYMOUS . "
                        AND user_type <> " . (int) USER_IGNORE . "
                        AND user_posts > 0
              ORDER BY user_posts DESC";
$result = $db->sql_query_limit($sql, 5, 0, 3600);

while ($row = $db->sql_fetchrow($result))
{
  $template->assign_block_vars('top_posters', array(
        'PROFILE'         => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
        'POSTS'       => $row['user_posts'],
        'SEARCH_LINK' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id='.$row["user_id"].'&sr=posts'),
    ));
}
$db->sql_freeresult($result);

$sql = "SELECT username, user_id, user_colour, user_regdate
              FROM " . USERS_TABLE . "
              WHERE user_id <> " . (int) ANONYMOUS . "
                        AND user_type <> " . (int) USER_IGNORE . "
              ORDER BY user_regdate DESC";
$result = $db->sql_query_limit($sql, 5, 0, 300);

while ($row = $db->sql_fetchrow($result))
{
  $template->assign_block_vars('new_users', array(
        'PROFILE'         => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
        'REGDATE'            => $user->format_date($row['user_regdate']),
    ));
}
$db->sql_freeresult($result); 
เปิดไฟล์ language/en/common.php
ค้นหา

โค้ด: เลือกทั้งหมด

'7_DAYS'        => '7 days', 
เติมหลัง

โค้ด: เลือกทั้งหมด

  'TOP_POSTS'        => 'Recent posts',
  'TOP_USERS'        => 'Most active users',
  'TOP_POSTERS'        => 'New users', 
เปิดไฟล์ styles/prosilver/template/index_body.html
ค้นหา

โค้ด: เลือกทั้งหมด

<!-- INCLUDE forumlist_body.html -->
เติมหลัง

โค้ด: เลือกทั้งหมด

<div class="forabg">
	<div class="inner"><span class="corners-top"><span></span></span>
		<table class="table1" cellspacing="1">
		<thead>
		<tr>
			<th style="width: 31%;">{L_TOP_POSTS}</th>
			<th style="width: 31%;">{L_TOP_USERS}</th>
			<th style="width: 31%;">{L_TOP_POSTERS}</th>
		</tr>
		</thead>
		<tbody>
			<tr class="bg2">
					<td valign="top">
					  <!-- BEGIN top_posts -->
						  <div><a href="{top_posts.POST_URL}">{top_posts.TOPIC_TITLE}</a><br />&nbsp;&nbsp;{L_FROM_TOP}: {top_posts.PROFILE} {top_posts.DATE}</div>
						<!-- END top_posts -->
					</td>
					<td valign="top">
            <!-- BEGIN top_posters -->
						  <div>{top_posters.PROFILE}<br />&nbsp;&nbsp;{L_POSTS}: <a href="{top_posters.SEARCH_LINK}">{top_posters.POSTS}</a></div>
						<!-- END top_posters -->
					</td>
					<td valign="top">
            <!-- BEGIN new_users -->
						  <div>{new_users.PROFILE}<br />&nbsp;&nbsp;{L_JOINED}: {new_users.REGDATE}</div>
						<!-- END new_users -->
					</td>
				</tr>
		</tbody>
		</table>

	<span class="corners-bottom"><span></span></span></div>
</div>
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 54