23 พฤษภาคม 2555, 12:21:02
ยินดีต้อนรับผู้เยี่ยมชม
  • noavata
  • ยินดีต้อนรับคุณ, ผู้เยี่ยมชม กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
    เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
Page Rank

ทำเว็บไซต์ | แต่งบอร์ด | ออกแบบ | SMF | Joomla | Drupal | WordPress | JQuery | CMS | ECommerce | Tel. +668-08577477

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: Order Stickied Topics จัดเรียงกระทู้ติดหมุด  (อ่าน 1289 ครั้ง)
0 สมาชิก และ 1 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
*


!NeverDie

United States Minor Outlying Islands   หญิง ผู้เริ่มต้นกระทู้นี้ ออฟไลน์ เว็บไซต์
icon message
general เมื่อ: 4 กุมภาพันธ์ 2553, 01:14:45
  • ชื่อ: Order Stickied Topics
  • ผู้เขียน: Nathaniel
  • นำเสนอโดย: DexMoreGroup
  • ประเภท: New Feature
  • รองรับ: SMF 1.1.xx, 2.0.xx
  • ปรับปรุงล่าสุด: 11 พฤษจิกายน 2551
  • ต้นฉบับ: Order Stickied Topics

รายละเอียด
      จัดเรียงกระทู้ติดหมุดตามลำดับความสำคัญของหัวข้อ ซึ่งแต่เดิม SMF จะจัดเรียงกระทู้ติดหมุดตามการตั้งค่าในการจัดเรียง ส่วนใหญ่ก็จะจัดเรียงตามวันที่ตั้งกระทู้ หรือกระทู้ที่มีการตอบล่าสุด ทำให้หัวข้อสำคัญๆ ที่เราต้องการให้ผู้ใช้เห็นก่อนอยู่ด้านบน กลับต้องตกลงมาอยู่ด้านล่างจากกระทู้ติดหมุดที่เริ่มหัวข้อทีหลัง หรือกระทู้ติดหมุดที่ถูกตอบ mod นี้จะช่วยท่านแก้ปัญหานี้ได้ครับ

ตัวอย่าง



แก้ไขไฟล์:

file $board/index.php

ค้นหา -->>
โค๊ด: [Select]
'optimizetables' => array('Admin.php', 'OptimizeTables'),

เพิ่มไว้หลัง -->
โค๊ด: [Select]
// The action for the Order Stickied Topics Mod.
'orderstickiedtopics' => array('Post.php', 'OrderStickiedTopics'),

file Source/Post.php

ค้นหา -->>
โค๊ด: [Select]
// So you wanna (un)sticky this...let's see.
if (isset($_POST['sticky']) && (empty($modSettings['enableStickyTopics']) || $_POST['sticky'] == $tmpstickied || !allowedTo('make_sticky')))
unset($_POST['sticky']);

แก้เป็น -->>
โค๊ด: [Select]
// So you wanna (un)sticky this...let's see.
if (isset($_POST['sticky']) && (empty($modSettings['enableStickyTopics']) || (empty($_POST['sticky']) == empty($tmpstickied)) || !allowedTo('make_sticky')))
unset($_POST['sticky']);

ค้นหา -->>
โค๊ด: [Select]
// Change the sticky status of this topic?
if (isset($_POST['sticky']) && (!allowedTo('make_sticky') || $_POST['sticky'] == $row['isSticky']))
unset($_POST['sticky']);

แก้เป็น -->>
โค๊ด: [Select]
// Change the sticky status of this topic?
if (isset($_POST['sticky']) && (!allowedTo('make_sticky') || (empty($_POST['sticky']) == empty($row['isSticky']))))
unset($_POST['sticky']);

ค้นหา -->>
โค๊ด: [Select]
// Assume the first message if no message ID was given.
$request = db_query("
SELECT
t.locked, t.numReplies, t.ID_MEMBER_STARTED, t.ID_FIRST_MSG,

แก้เป็น -->>
โค๊ด: [Select]
// Assume the first message if no message ID was given.
$request = db_query("
SELECT
t.locked, t.numReplies, t.ID_MEMBER_STARTED, t.ID_FIRST_MSG, t.isSticky,

ค้นหา -->>
โค๊ด: [Select]
'board' => $board,
'lock_mode' => isset($_POST['lock']) ? (int) $_POST['lock'] : null,
'sticky_mode' => isset($_POST['sticky']) && !empty($modSettings['enableStickyTopics']) ? (int) $_POST['sticky'] : null,

แก้เป็น -->>
โค๊ด: [Select]
'board' => $board,
'lock_mode' => isset($_POST['lock']) ? (int) $_POST['lock'] : null,
'sticky_mode' => isset($_POST['sticky']) && !empty($modSettings['enableStickyTopics']) && !(empty($_POST['sticky']) == empty($row['is_sticky'])) ? (int) $_POST['sticky'] : null,

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com

file Source/MessageIndex.php

ค้นหา -->>
โค๊ด: [Select]
$context['can_post_poll'] = $modSettings['pollMode'] == '1' && allowedTo('poll_post');

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Add the 'can_order_stickied_topics' permission, for the Order Stickied Topics mod.
$context['can_order_stickied_topics'] = allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']);

file Theme/MessageIndex.template.php

ค้นหา -->>
โค๊ด: [Select]
'post_poll' => array('test' => 'can_post_poll', 'text' => 'smf20', 'image' => 'new_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Show the Link/Button for the Order Stickied Topics Mod.
'order_stickied_topics' => array('test' => 'can_order_stickied_topics', 'text' => 'OrderStickiedTopics_title', 'lang' => true, 'url' => $scripturl . '?action=orderstickiedtopics;board=' . $context['current_board'] . '.0;'),

file Theme/Post.template.php

ค้นหา-->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Function to display the list of stickiedtopics.
function template_orderstickiedtopics()
{
global $context, $txt, $board_info, $scripturl, $settings;

// Show the start of the table, as well as the main heading and the column headings.
echo '
<br />
<table border="0" align="center" cellspacing="1" cellpadding="4" class="bordercolor" width="60%">
<tr class="catbg3">
<td colspan="5" align="left">
<div style="float: left;">
<b>', $txt['OrderStickiedTopics_title'] ,'</b> - <a href="' . $scripturl . '?board=', $context['current_board'], '.0">', $board_info['name'], '</a>
</div>
</td>
</tr>
<tr class="titlebg">
<th>', $txt[70], '</th>
<th>', $txt['OrderStickiedTopics_current'], '</th>
<th>', $txt['OrderStickiedTopics_modify'], '</th>
</tr>';

// Show a list of the topics.
foreach($context['topics'] as $topic)
{
echo '
<tr>
<td align="left" valign="top" class="windowbg"><b><a href="', $scripturl, '?topic=', $topic['id'], '.0">', $topic['title'], '</a></b></td>
<td align="left" valign="top" class="windowbg2" style="text-align:center;">', $topic['value'], '</td>
<td align="center" valign="top" class="windowbg2">
<a href="', $scripturl, '?action=orderstickiedtopics;topic=', $topic['id'],';decrease"><img src="', $settings['images_url'], '/sort_down.gif" alt="', $txt['OrderStickiedTopics_decrease'], '" border="0" /></a>
<a href="', $scripturl, '?action=orderstickiedtopics;topic=', $topic['id'],';increment"><img src="', $settings['images_url'], '/sort_up.gif" alt="', $txt['OrderStickiedTopics_increase'], '" border="0" /></a>
&nbsp;&nbsp;&nbsp;<a href="', $scripturl, '?action=orderstickiedtopics;topic=', $topic['id'],';unsticky">', $txt['OrderStickiedTopics_unsticky'], '</a>
</td>
</tr>';
}

// If we have no topics, then show a short message telling the moderator.
if(empty($context['topics']))
echo '
<tr>
<td colspan="3" valign="top" class="windowbg">', $txt['OrderStickiedTopics_emptylist'], '</td>
</tr>';

// Finish the table.
echo '
<tr class="catbg3">
<td colspan="5" align="left">
<b style="font-size:14px;"><a href="', $scripturl, '?board=', $context['current_board'], '.0">', $txt['OrderStickiedTopics_back'], ' ', $board_info['name'], '</a></b>
</td>
</tr>
</table>';
}

file language/Modifications.thai.php or Modifications.thai-utf8.php

เพิ่ม -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com

ลิงค์หัวข้อ: http://dexmore.com/topic/371
Windows XP    Firefox 3.5.7   see ip บันทึกการเข้า
ดูรายการสิ่งของบัตรผ่านห้องเกมส์ใช้ได้ 30 วัน  

-:-DexMore.Com แหล่งมั่วสุมทางปัญญา-:-
*
*


!Personal

Germany   ชาย ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 1 เมื่อ: 21 มิถุนายน 2553, 09:52:02
สำหรับ SMF 2.0.xx

แก้ไขไฟล์:

file $boarddir/index.php

ค้นหา -->>
โค๊ด: [Select]
'pm' => array('PersonalMessage.php', 'MessageMain'),

แก้เป็น -->>
โค๊ด: [Select]
'pm' => array('PersonalMessage.php', 'MessageMain'),
// The action for the Order Stickied Topics Mod.
'orderstickiedtopics' => array('Post.php', 'OrderStickiedTopics'),

file $sourcedir/Post.php

ค้นหา -->>
โค๊ด: [Select]
// So you wanna (un)sticky this...let's see.
if (isset($_POST['sticky']) && (empty($modSettings['enableStickyTopics']) || $_POST['sticky'] == $topic_info['is_sticky'] || !allowedTo('make_sticky')))
unset($_POST['sticky']);

แก้เป็น -->>
โค๊ด: [Select]
// So you wanna (un)sticky this...let's see.
if (isset($_POST['sticky']) && (empty($modSettings['enableStickyTopics']) || (empty($_POST['sticky']) == empty($topic_info['is_sticky'])) || !allowedTo('make_sticky')))
unset($_POST['sticky']);

ค้นหา -->>
โค๊ด: [Select]
// Change the sticky status of this topic?
if (isset($_POST['sticky']) && (!allowedTo('make_sticky') || $_POST['sticky'] == $topic_info['is_sticky']))
unset($_POST['sticky']);

แก้เป็น -->>
โค๊ด: [Select]
// Change the sticky status of this topic?
if (isset($_POST['sticky']) && (!allowedTo('make_sticky') || (empty($_POST['sticky']) == empty($topic_info['is_sticky']))))
unset($_POST['sticky']);

ค้นหา -->>
โค๊ด: [Select]
// Assume the first message if no message ID was given.
$request = $smcFunc['db_query']('', '
SELECT
t.locked, t.num_replies, t.id_member_started, t.id_first_msg,

แก้เป็น -->>
โค๊ด: [Select]
[ // Assume the first message if no message ID was given.
$request = $smcFunc['db_query']('', '
SELECT
t.locked, t.num_replies, t.id_member_started, t.id_first_msg, t.is_sticky,

ค้นหา -->>
โค๊ด: [Select]
'board' => $board,
'lock_mode' => isset($_POST['lock']) ? (int) $_POST['lock'] : null,
'sticky_mode' => isset($_POST['sticky']) && !empty($modSettings['enableStickyTopics']) ? (int) $_POST['sticky'] : null,

แก้เป็น -->>
โค๊ด: [Select]
'board' => $board,
'lock_mode' => isset($_POST['lock']) ? (int) $_POST['lock'] : null,
'sticky_mode' => isset($_POST['sticky']) && !empty($modSettings['enableStickyTopics']) && !(empty($_POST['sticky']) == empty($row['is_sticky'])) ? (int) $_POST['sticky'] : null,

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Function for the Order Stickied Topics Action.
function OrderStickiedTopics()
{
global $board, $smcFunc, $board_info, $modSettings, $context, $txt, $topic;

// Make sure that we have a valid board.
if(empty($board))
redirectexit();

// Make sure that the user is allowed to sticky topics. And that we are using stickied topics.
if(!allowedTo('make_sticky') || empty($modSettings['enableStickyTopics']))
redirectexit('board='.$board.'.0');

// Do we have a topic id?
if(!empty($topic))
{
// First get some information about this topic.
$result = $smcFunc['db_query']('', '
SELECT is_sticky
FROM {db_prefix}topics
WHERE id_topic = {int:topic_id}
AND id_board = {int:board_id}',
array(
'board_id' => $board,
'topic_id' => $topic,
)
);

// Make sure that we got some valid topic information.
if(!($data = $smcFunc['db_fetch_assoc']($result)))
redirectexit('action=orderstickiedtopics;board='.$board.'.0');

$smcFunc['db_free_result']($result);

// Make sure that we aren't about to unsticky this topic, and that its a sticky.
if(($data['is_sticky'] == 0)
|| (($data['is_sticky'] == 1) && isset($_GET['decrease'])))
redirectexit('action=orderstickiedtopics;board='.$board.'.0;');

// Get a correct value to set for the 'stickyness' of this topic. :D
if(isset($_GET['unsticky']))
$value = '0';
// Increment?
elseif(isset($_GET['increment']))
$value = "is_sticky + 1";
// Decrease?
elseif(isset($_GET['decrease']))
$value = "is_sticky - 1";
// If we have no valid value, then we can't do anything. :(
else
redirectexit('action=orderstickiedtopics;board='.$board.'.0');

// Update the topic.
$smcFunc['db_query']('','
UPDATE {db_prefix}topics
SET is_sticky = {raw:value}
WHERE id_topic = {int:topic_id}',
array(
'topic_id' => $topic,
'value' => $value,
)
);

// Finally redirect us back to the order stickied topics page for this topics board.
redirectexit('action=orderstickiedtopics;board='.$board.'.0;');
}

// Get a list of Stickied Topics for this board.
$result = $smcFunc['db_query']('','
SELECT t.id_topic, t.is_sticky, m.subject
FROM ({db_prefix}topics as t)
LEFT JOIN {db_prefix}messages as m on (m.id_msg = t.id_first_msg)
WHERE is_sticky != 0
AND t.id_board = {int:board_id}
ORDER BY t.is_sticky DESC, t.id_last_msg DESC',
array(
'board_id' => $board,
)
);

// Setup the topic list for the template.
$context['topics'] = array();
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$context['topics'][] = array(
'id' => $row['id_topic'],
'value' => $row['is_sticky'],
'title' => $row['subject'],
);
}
$smcFunc['db_free_result']($result);

// Finally set up some necessary *stuff* for the template.
loadTemplate('Post');
$context['sub_template'] = 'orderstickiedtopics';
$context['page_title'] = $board_info['name'];
}

file $sourcedir/MessageIndex.php

ค้นหา -->>
โค๊ด: [Select]
$context['can_post_poll'] = $modSettings['pollMode'] == '1' && allowedTo('poll_post');

แก้เป็น -->>
โค๊ด: [Select]
$context['can_post_poll'] = $modSettings['pollMode'] == '1' && allowedTo('poll_post');
// Add the 'can_order_stickied_topics' permission, for the Order Stickied Topics mod.
$context['can_order_stickied_topics'] = allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']);

file $themedir/MessageIndex.template.php

ค้นหา -->>
โค๊ด: [Select]
'post_poll' => array('test' => 'can_post_poll', 'text' => 'new_poll', 'image' => 'new_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'),

แก้เป็น -->>
โค๊ด: [Select]
'post_poll' => array('test' => 'can_post_poll', 'text' => 'new_poll', 'image' => 'new_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'),
// Show the Link/Button for the Order Stickied Topics Mod.
'order_stickied_topics' => array('test' => 'can_order_stickied_topics', 'text' => 'OrderStickiedTopics_title', 'lang' => true, 'url' => $scripturl . '?action=orderstickiedtopics;board=' . $context['current_board'] . '.0'),

file $themedir/Post.template.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Function to display the list of stickiedtopics.
function template_orderstickiedtopics()
{
global $context, $txt, $board_info, $scripturl, $settings;

// Show the start of the table, as well as the main heading and the column headings.
echo '
<br />
<table border="0" align="center" cellspacing="1" cellpadding="4" class="bordercolor" width="60%">
<tr class="catbg3">
<td colspan="5" align="left">
<div style="float: left;">
<b>', $txt['OrderStickiedTopics_title'] ,'</b> - <a href="' . $scripturl . '?board=', $context['current_board'], '.0">', $board_info['name'], '</a>
</div>
</td>
</tr>
<tr class="titlebg">
<th>', $txt['subject'], '</th>
<th>', $txt['OrderStickiedTopics_current'], '</th>
<th>', $txt['OrderStickiedTopics_modify'], '</th>
</tr>';

// Show a list of the topics.
foreach($context['topics'] as $topic)
{
echo '
<tr>
<td align="left" valign="top" class="windowbg"><b><a href="', $scripturl, '?topic=', $topic['id'], '.0">', $topic['title'], '</a></b></td>
<td align="left" valign="top" class="windowbg2" style="text-align:center;">', $topic['value'], '</td>
<td align="center" valign="top" class="windowbg2">
<a href="', $scripturl, '?action=orderstickiedtopics;topic=', $topic['id'],';decrease"><img src="', $settings['images_url'], '/sort_down.gif" alt="', $txt['OrderStickiedTopics_decrease'], '" border="0" /></a>
<a href="', $scripturl, '?action=orderstickiedtopics;topic=', $topic['id'],';increment"><img src="', $settings['images_url'], '/sort_up.gif" alt="', $txt['OrderStickiedTopics_increase'], '" border="0" /></a>
&nbsp;&nbsp;&nbsp;<a href="', $scripturl, '?action=orderstickiedtopics;topic=', $topic['id'],';unsticky">', $txt['OrderStickiedTopics_unsticky'], '</a>
</td>
</tr>';
}

// If we have no topics, then show a short message telling the moderator.
if(empty($context['topics']))
echo '
<tr>
<td colspan="3" valign="top" class="windowbg">', $txt['OrderStickiedTopics_emptylist'], '</td>
</tr>';

// Finish the table.
echo '
<tr class="catbg3">
<td colspan="5" align="left">
<b style="font-size:14px;"><a href="', $scripturl, '?board=', $context['current_board'], '.0">', $txt['OrderStickiedTopics_back'], ' ', $board_info['name'], '</a></b>
</td>
</tr>
</table>';
}

file $languagedir/Modifications.thai-utf8.php

เพิ่ม -->>
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com


ลิงค์หัวข้อ: http://dexmore.com/topic/371
Windows XP    Firefox 3.6.3   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
kaijae2004

icon message
general ความคิดเห็นที่ 2 เมื่อ: 15 กรกฎาคม 2553, 22:00:02
ทำไมผมคลิกที่ Order Stickied Topics แล้วถึงไม่ขึ้นเหมือนที่นี่ครับ มันกลับเด้งไปที่หน้าแรกของกระทู้


อ้อ ผมตาลายเอง มองไปว่า index.php ใน sources มิน่าถึงไม่เปลี่ยน

ลิงค์หัวข้อ: http://dexmore.com/topic/371
« แก้ไขครั้งสุดท้าย: 15 กรกฎาคม 2553, 22:41:15 โดย kaijae2004 » Windows XP    Firefox 3.0.11   see ip บันทึกการเข้า
โฮสต์ดีๆ บริการด้วยใจ
*
*


!Personal

Germany   ชาย ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 3 เมื่อ: 15 กรกฎาคม 2553, 22:08:46
อาการนั้นคือยังไม่ได้แก้ไขไฟล์ $boarddir/index.php ครับ

ลิงค์หัวข้อ: http://dexmore.com/topic/371
Windows XP    Firefox 3.6.6   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
ส่งหัวข้อนี้พิมพ์ หน้า: 1 
กระโดดไป:  

Creative Commons License

SMF Thai Translation Powered by SMF © 2006–2012, Simple Machines LLC

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : 11 ชั่วโมงที่ผ่านมา

jQuery Plugin Copyright © 2551-2555 Themes Design & Hosting by DexMoreGroup

Sitemap | Thai Simple Machines Forum support SMF Thai

Web Begining | SMF Modifications | SMF Thai Translation Web Begining

Drupal | WordPress | CMS Joomla | jQuery Plugin | Web Graphics CMS Joomla