ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: ทำการ Recent Posts on Topic SMF  (อ่าน 2167 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
Chaya1995
Newbie
*

พลังน้ำใจ: 1
ออฟไลน์ ออฟไลน์

กระทู้: 49



ดูรายละเอียด
« เมื่อ: 15 ตุลาคม 2019, 13:08:49 »

ขอวิธีการทำ Recent Posts on Topic ให้อยู่บนสุดหน่อยครับโดยใช้ธีม

ธีม https://custom.simplemachines....rg/themes/index.php?lemma=2833
ตย https://www.picz.in.th/image/caqjFl    จาก  https://support.indytheme.com/index.php
« แก้ไขครั้งสุดท้าย: 15 ตุลาคม 2019, 13:09:29 โดย Chaya1995 » บันทึกการเข้า
romance69
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 169
ออฟไลน์ ออฟไลน์

กระทู้: 2,159



ดูรายละเอียด เว็บไซต์
« ตอบ #1 เมื่อ: 15 ตุลาคม 2019, 15:54:56 »

ขอวิธีการทำ Recent Posts on Topic ให้อยู่บนสุดหน่อยครับโดยใช้ธีม

ธีม https://custom.simplemachines....rg/themes/index.php?lemma=2833
ตย https://www.picz.in.th/image/caqjFl     จาก  https://support.indytheme.com/index.php

อันนี้เครดิตโค้ดของ indytheme นะครับ

เปิดไฟล์ BoardIndex.template.php เลื่อนลงล่างสุด วางโค้ดนี้ก่อน ?>
โค๊ด:
function recent_post()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;
// This is the "Recent Posts" bar.
if (!empty($settings['number_recent_posts']))
{
echo '
<div class="title_bar">
<h4 class="titlebg">
<span class="ie6_header floatleft">
<a href="', $scripturl, '?action=recent"><img class="icon" src="', $settings['images_url'], '/post/xx.gif" alt="', $txt['recent_posts'], '" /></a>
', $txt['recent_posts'], '
</span>
</h4>
</div>
<div class="hslice" id="recent_posts_content">
<div class="entry-title" style="display: none;">', $context['forum_name_html_safe'], ' - ', $txt['recent_posts'], '</div>
<div class="entry-content" style="display: none;">
<a rel="feedurl" href="', $scripturl, '?action=.xml;type=webslice">', $txt['subscribe_webslice'], '</a>
</div>';

// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
<p id="infocenter_onepost" class="middletext">
', $txt['recent_view'], ' &quot;', $context['latest_post']['link'], '&quot; ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')<br />
</p>';
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="2" cellspacing="0" width="100%" border="0" id="ic_recentposts" class="middletext">';

/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
$indytheme = 0;
foreach ($context['latest_posts'] as $post)
{
$indytheme++;
echo '
<tr>
<td valign="top">&nbsp;<img src="', $settings['images_url'], '/icon_number/',$indytheme,'.png" > &nbsp;<strong>', $post['link'], '</strong></td>
<td valign="top" nowrap="nowrap">[ ', $post['board']['link'], ' ]</td>
<td valign="top" nowrap="nowrap">', $txt['by'], ' ', $post['poster']['link'], ' </td>
<td align= "right" valign="top" nowrap="nowrap">', $post['time'], '</td>';
echo '
</tr>';
}

}
echo '
</table>';
echo '
<br/></div>';
}
}

สามารถนำฟังชั่นนี้ไปใส่ที่ๆ ต้องการให้แสดง
โค๊ด:
recent_post();

อัพไฟล์รูปขึ้นโฮสที่ใช้ตามพาท ธีมที่ใช้/images/ ว่างโฟรเดอร์ไปเลย
โค๊ด:
https://www.mediafire.com/file/8vt8hl3z1nozrnu/icon_number.zip/file

ปล. โค้ดไม่ได้ลองนะครับ
« แก้ไขครั้งสุดท้าย: 15 ตุลาคม 2019, 15:57:18 โดย romance69 » บันทึกการเข้า
Chaya1995
Newbie
*

พลังน้ำใจ: 1
ออฟไลน์ ออฟไลน์

กระทู้: 49



ดูรายละเอียด
« ตอบ #2 เมื่อ: 15 ตุลาคม 2019, 17:32:58 »

ขอวิธีการทำ Recent Posts on Topic ให้อยู่บนสุดหน่อยครับโดยใช้ธีม

ธีม https://custom.simplemachines....rg/themes/index.php?lemma=2833
ตย https://www.picz.in.th/image/caqjFl     จาก  https://support.indytheme.com/index.php

อันนี้เครดิตโค้ดของ indytheme นะครับ

เปิดไฟล์ BoardIndex.template.php เลื่อนลงล่างสุด วางโค้ดนี้ก่อน ?>
โค๊ด:
function recent_post()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;
// This is the "Recent Posts" bar.
if (!empty($settings['number_recent_posts']))
{
echo '
<div class="title_bar">
<h4 class="titlebg">
<span class="ie6_header floatleft">
<a href="', $scripturl, '?action=recent"><img class="icon" src="', $settings['images_url'], '/post/xx.gif" alt="', $txt['recent_posts'], '" /></a>
', $txt['recent_posts'], '
</span>
</h4>
</div>
<div class="hslice" id="recent_posts_content">
<div class="entry-title" style="display: none;">', $context['forum_name_html_safe'], ' - ', $txt['recent_posts'], '</div>
<div class="entry-content" style="display: none;">
<a rel="feedurl" href="', $scripturl, '?action=.xml;type=webslice">', $txt['subscribe_webslice'], '</a>
</div>';

// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
<p id="infocenter_onepost" class="middletext">
', $txt['recent_view'], ' &quot;', $context['latest_post']['link'], '&quot; ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')<br />
</p>';
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="2" cellspacing="0" width="100%" border="0" id="ic_recentposts" class="middletext">';

/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
$indytheme = 0;
foreach ($context['latest_posts'] as $post)
{
$indytheme++;
echo '
<tr>
<td valign="top">&nbsp;<img src="', $settings['images_url'], '/icon_number/',$indytheme,'.png" > &nbsp;<strong>', $post['link'], '</strong></td>
<td valign="top" nowrap="nowrap">[ ', $post['board']['link'], ' ]</td>
<td valign="top" nowrap="nowrap">', $txt['by'], ' ', $post['poster']['link'], ' </td>
<td align= "right" valign="top" nowrap="nowrap">', $post['time'], '</td>';
echo '
</tr>';
}

}
echo '
</table>';
echo '
<br/></div>';
}
}

สามารถนำฟังชั่นนี้ไปใส่ที่ๆ ต้องการให้แสดง
โค๊ด:
recent_post();

อัพไฟล์รูปขึ้นโฮสที่ใช้ตามพาท ธีมที่ใช้/images/ ว่างโฟรเดอร์ไปเลย
โค๊ด:
https://www.mediafire.com/file/8vt8hl3z1nozrnu/icon_number.zip/file

ปล. โค้ดไม่ได้ลองนะครับ







ขอบคุณมากครับผม
บันทึกการเข้า
หน้า: [1]   ขึ้นบน
พิมพ์