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

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

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: Attachments Positioning แสดงรูปไฟล์แนบแนวเดียวกับข้อความ  (อ่าน 1971 ครั้ง)
0 สมาชิก และ 2 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
  • ชื่อ: Attachments Positioning
  • ผู้เขียน: quake101
  • นำเสนอโดย: DexMoreGroup
  • ประเภท: Attachments
  • รองรับ: SMF 1.1.xx
  • ปรับปรุงล่าสุด: 14 เมษายน 2551
  • ต้นฉบับ: Attachments Positioning

รายละเอียด
      ปกติไฟล์แนบของ SMF จะแสดงบริเวณล่างสุดของกระทู้โดยมีเส้นคั่น และแสดงเป็นรูปขนาดย่อหากต้องการรูปเต็มขนาดก็ต้องคลิกอีกทีหนึ่ง ทำให้ไม่สะดวกในการใช้รูปประข้อความ หรือบทความเพราะว่ารูปกับข้อความอยู่คนละตำแหน่งกัน mod นี้จะช่วยให้การแสดงไฟล์แนบอยู่แนวเดียวกับข้อความ เช่น ขณะผู้เขียนกำลังพิมพ์คำอธิบาย mod นี้อยู่และต้องการแสดงรูปประกอบก็สามารถทำได้เลยโดยการแทรกแบบนี้ [attachment=1] รูปไฟล์แนบก็จะอยู่ในตำแหน่งที่แทรก ซึ่งการแทรกก็ทำได้อย่างง่ายๆ แค่คลิกเดียว ดังรูปตัวอย่าง

ตัวอย่าง


แก้ไขไฟล์:

file $sourcedir/Display.php

ค้นหา -->>
โค๊ด: [Select]
if (empty($options['view_newest_first']))
$counter++;

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Attachment Positioniong Mod: Start
if (empty($modSettings['attachmentEnable']) || !allowedTo('view_attachments')) {
$pattern = '#\[attachment=([0-9])\]#i'.($context['utf8'] ? 'u' : '') ;
$output['body'] = preg_replace($pattern, $txt['attachment_nopermission'], $output['body']);
} else {
// GRACEFULLY REPLACE ATTACHMENTS INSIDE QUOTES OR CODE TAGS WITH THE TEXT STRING [ ATTACHMENT ]
// WE MAY NEED TO DO THIS FOR POSTS *WITHOUT* ANY ATTACHMENTS
if(preg_match_all('#<div class="(code|quote)">(.*?)</div>#im'. ($context['utf8'] ? 'u' : ''), $output['body'], $quotecode, PREG_PATTERN_ORDER)) {
$quotecode = array_unique($quotecode[0]);
// GO THROUGH EACH QUOTE/CODE ELEMENT
$pattern = '#\[attachment=([0-9])\]#i'.($context['utf8'] ? 'u' : '') ;
foreach ($quotecode as $a => $b) {
$c = $b;
$c = preg_replace($pattern, $txt['attachment'], $c);
$output['body'] = str_replace($b, $c, $output['body']);
}
unset($a,$b,$c,$quotecode,$pattern);
}

// HOW MANY ATTACHMENTS ARE THERE?
$z = count($output['attachment']);
// NO ATTACHMENTS, SO WE CAN AVOID THIS PART
if ($z != 0) {
// NOW REPLACE OUR ATTACHMENT BBCODE WITH THE ATTACHMENTS
for($i=0;$i<$z;$i++) {
$attachment = $output['attachment'][$i];
if(strpos($output['body'],'[attachment='.($i+1).']') !== FALSE) {
$replace = '<div class="smalltext">';
if ($attachment['is_image']) {
                            // Don't display image attachments that use the bbcode twice
                            $context['dontshowattachment'][$i+1] = $attachment['id'];
if ($attachment['thumbnail']['has_thumb']) {
$replace .= '
<a href="'. $attachment['href']. ';image" id="link_'. $attachment['id']. '" onclick="'. $attachment['thumbnail']['javascript'] .'"><img src="'. $attachment['thumbnail']['href']. '" alt="" id="thumb_'. $attachment['id']. '" border="0" /></a><br />';
} else {
$replace .= '
<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
}
}
$replace .= '<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ('. $attachment['size']. ($attachment['is_image'] ? '. ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)</div>';

$output['body'] = str_replace('[attachment='.($i+1).']',$replace, $output['body']);
}
unset($replace);
}
}
// GRACEFULLY REPLACE BBCODE FOR ANY INVALID/MISSING/DELETED ATTACHMENTS WITH ERROR TEXT STRING
$pattern = '#\[attachment=([0-9a-z\#\-_ ]{1,10})\]#i'.($context['utf8'] ? 'u' : '') ;
$output['body'] = preg_replace($pattern, $txt['attachment_invalid'], $output['body']);
}
    // Attachment Positioniong Mod: End

file $sourcedir/Post.php

ค้นหา -->>
โค๊ด: [Select]
$context['message']['body'] = parse_bbc($context['message']['body'], $row['smileysEnabled'], $row['ID_MSG']);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Attachment Positioniong Mod: Start
// FETCH ATTACHMENTS IF ENABLED AND ALLOWED TO VIEW ATTACHMENTS
if (!empty($modSettings['attachmentEnable']) && allowedTo('view_attachments')) {

// GRACEFULLY REPLACE ATTACHMENTS INSIDE QUOTES OR CODE TAGS WITH THE TEXT STRING [ ATTACHMENT ]
// WE MAY NEED TO DO THIS FOR POSTS *WITHOUT* ANY ATTACHMENTS
if(preg_match_all('#<div class="(code|quote)">(.*?)</div>#im'. ($context['utf8'] ? 'u' : ''), $context['message']['body'], $quotecode, PREG_PATTERN_ORDER)) {
$quotecode = array_unique($quotecode[0]);
// GO THROUGH EACH QUOTE/CODE ELEMENT
$pattern = '#\[attachment=([0-9])\]#i'.($context['utf8'] ? 'u' : '') ;
foreach ($quotecode as $a => $b) {
$c = $b;
$c = preg_replace($pattern, $txt['attachment'], $c);
$context['message']['body'] = str_replace($b, $c, $context['message']['body']);
}
unset($a,$b,$c,$quotecode,$pattern);
}

// WE NEED ACCESS TO THE GLOBALS
global $settings, $attachments;
// QUERY TO PULL THE ATTACHMENTS - MODIFIED SLIGHTLY FROM DISPLAY.PHP CODE
$attachments = array();
$request = db_query("
SELECT
a.ID_ATTACH, a.ID_MSG, a.filename, IFNULL(a.size, 0) AS filesize, a.downloads,
a.width, a.height" . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ",
IFNULL(thumb.ID_ATTACH, 0) AS ID_THUMB, thumb.width AS thumb_width, thumb.height AS thumb_height") . "
FROM {$db_prefix}attachments AS a" . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : "
LEFT JOIN {$db_prefix}attachments AS thumb ON (thumb.ID_ATTACH = a.ID_THUMB)") . "
WHERE a.ID_MSG = ".$row['ID_MSG']."
AND a.attachmentType = 0", __FILE__, __LINE__);
$temp = array();
$z = mysql_num_rows($request);
// ONLY CONTINUE IF WE HAVE ATTACHMENTS
if ($z != 0) {
while ($temprow = mysql_fetch_assoc($request)) {
$temp[$temprow['ID_ATTACH']] = $temprow;
if (!isset($attachments[$temprow['ID_MSG']])) {
$attachments[$temprow['ID_MSG']] = array();
}
}
mysql_free_result($request);
// NOW SORT
ksort($temp);
// NOW PUT INTO THE ATTACHMENTS ARRAY
foreach ($temp as $temprow) {
$attachments[$temprow['ID_MSG']][] = $temprow;
}
// TIDY UP
unset($temp,$temprow);

// REQUIRE FUNCTION FROM THAT FILE
require_once($sourcedir . '/Display.php');
// HERE WE TRY TO USE IDENTICAL VARS AS USED BY DISPLAY.PHP TO MAKE IT EASIER
$output = array();
$output['attachment'] = loadAttachmentContext($row['ID_MSG']);

// NOW REPLACE OUR ATTACHMENT BBCODE WITH THE ATTACHMENTS
for($i=0;$i<$z;$i++) {
$attachment = $output['attachment'][$i];
if(strpos($context['message']['body'],'[attachment='.($i+1).']') !== FALSE) {
$replace = '<div class="smalltext">';
if ($attachment['is_image']) {
if ($attachment['thumbnail']['has_thumb']) {
$replace .= '
<a href="'. $attachment['href']. ';image" id="link_'. $attachment['id']. '" onclick="'. $attachment['thumbnail']['javascript'] .'"><img src="'. $attachment['thumbnail']['href']. '" alt="" id="thumb_'. $attachment['id']. '" border="0" /></a><br />';
} else {
$replace .= '
<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
}
}
$replace .= '<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ('. $attachment['size']. ($attachment['is_image'] ? '. ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)</div>';

$context['message']['body'] = str_replace('[attachment='.($i+1).']',$replace, $context['message']['body']);
}
unset($replace);
}
}
// GRACEFULLY REPLACE BBCODE FOR ANY INVALID/MISSING/DELETED ATTACHMENTS WITH ERROR TEXT STRING
$pattern = '#\[attachment=([0-9a-z\#\-_ ]{1,10})\]#i'.($context['utf8'] ? 'u' : '') ;
$context['message']['body'] = preg_replace($pattern, $txt['attachment_invalid'], $context['message']['body']);
}
// Attachment Positioniong Mod: End

ค้นหา -->>
โค๊ด: [Select]
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// SHOW ATTACHMENT TEXT STRING OR ERROR TEXT STRING IN TOPIC HISTORY
global $txt;
$pattern = '#\[attachment=([0-9])\]#i'.($context['utf8'] ? 'u' : '') ;
if (empty($modSettings['attachmentEnable']) || !allowedTo('view_attachments')) {
$row['body'] = preg_replace($pattern, $txt['attachment_nopermission'], $row['body']);
} else {
$row['body'] = preg_replace($pattern, $txt['attachment'], $row['body']);
}

ค้นหา -->>
โค๊ด: [Select]
$context['preview_message'] = parse_bbc($context['preview_message'], isset($_REQUEST['ns']) ? 0 : 1);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// SHOW ATTACHMENT TEXT STRING OR ERROR TEXT STRING IN TOPIC HISTORY
$pattern = '#\[attachment=([0-9])\]#i'.($context['utf8'] ? 'u' : '') ;
if (empty($modSettings['attachmentEnable']) || !allowedTo('view_attachments')) {
$context['preview_message'] = preg_replace($pattern, $txt['attachment_nopermission'], $context['preview_message']);
} else {
$context['preview_message'] = preg_replace($pattern, $txt['attachment'], $context['preview_message']);
}

file $sourcedir/Recent.php

ค้นหา -->>
โค๊ด: [Select]
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]

// SHOW ATTACHMENT TEXT STRING OR ERROR TEXT STRING IN TOPIC HISTORY
$pattern = '#\[attachment=([0-9])\]#i'.($context['utf8'] ? 'u' : '') ;
if (empty($modSettings['attachmentEnable']) || !allowedTo('view_attachments')) {
$row['body'] = preg_replace($pattern, $txt['attachment_nopermission'], $row['body']);
} else {
$row['body'] = preg_replace($pattern, $txt['attachment'], $row['body']);
}


file $themedir/Display.template.php

ค้นหา -->>
โค๊ด: [Select]
foreach ($message['attachment'] as $attachment)

แก้เป็น -->>
โค๊ด: [Select]
$i = 0;
            foreach ($message['attachment'] as $attachment)

ค้นหา -->>
โค๊ด: [Select]
if ($attachment['is_image'])

แก้เป็น -->>
โค๊ด: [Select]
if (empty($context['dontshowattachment'][$i+1])) $context['dontshowattachment'][$i+1] = "";
                if ($attachment['is_image'] && $context['dontshowattachment'][$i+1] !== $attachment['id'])

ค้นหา -->>
โค๊ด: [Select]
echo '
<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';

แก้เป็น -->>
โค๊ด: [Select]
if ($context['dontshowattachment'][$i+1] !== $attachment['id'])
echo '
<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
   $i++;

file $themedir/Post.template.php

ค้นหา -->>
โค๊ด: [Select]
foreach ($context['current_attachments'] as $attachment)
echo '
<input type="checkbox" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="check" /> ', $attachment['name'], '<br />';

แก้เป็น -->>
โค๊ด: [Select]
foreach ($context['current_attachments'] as $attid => $attachment)
echo '
<input type="checkbox" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="check" /> ', $attachment['name'], ' <a href="javascript:void(0);" onclick="replaceText(\'[attachment=',($attid+1),']\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">[', $txt['attachment_insert'] ,' ', ($attid+1),']</a><br />';

ค้นหา -->>
โค๊ด: [Select]
<input type="file" size="48" name="attachment[]" />';

แก้เป็น -->>
โค๊ด: [Select]
<input type="file" size="48" name="attachment[]" /> <a href="javascript:void(0);" onclick="replaceText(\'[attachment=', (count($context['current_attachments']) + 1) ,']\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">[', $txt['attachment_insert'] ,' ', (count($context['current_attachments']) + 1) ,']</a>';

ค้นหา -->>
โค๊ด: [Select]
function addAttachment()
{
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="48" name="attachment[]" /><span id="moreAttachments"></span>\');
allowed_attachments = allowed_attachments - 1;

return true;
}

แก้เป็น -->>
โค๊ด: [Select]
var count_attachments = ', count($context['current_attachments']) ,' + 1;
function addAttachment()
{
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

count_attachments = count_attachments + 1 ;
setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="48" name="attachment[]" /> <a href="javascript:void(0);" onclick="replaceText(\\\'[attachment=\'+ count_attachments +\']\\\', document.forms.', $context['post_form'], '.', $context['post_box_name'], '); return false;">[', $txt['attachment_insert'] ,' \'+ count_attachments +\']</a> <span id="moreAttachments"></span>\');
allowed_attachments = allowed_attachments - 1;

return true;
}

file $themedir/languages/Modifications.thai-utf8.php

เพิ่ม -->>
โค๊ด: [Select]
$txt['attachment'] = ' [ ไพล์แนบ ] ';
$txt['attachment_nopermission'] = ' [ ไพล์แนบ: คุณไม่ได้รับอนุญาตให้ดูไฟล์แนบ ] ';
$txt['attachment_invalid'] = ' [ ไฟล์แนบไม่ถูกต้อง หรือไม่มีอยู่ ] ';
$txt['attachment_disabled'] = ' [ ไฟล์แนบไม่ได้เปิดใช้งาน ] ';
$txt['attachment_insert'] = 'แทรกไฟล์แนบ';

วิธีใช้:


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



Thailand   หญิง ออฟไลน์ เว็บไซต์
icon message
general ความคิดเห็นที่ 1 เมื่อ: 29 พฤศจิกายน 2554, 16:45:11
สอบถามวิธีลง Mod  Attachments Positioning
สำหรับ smf 2.0.1 ใช้ธีม Yabb SE Next Gen ค่ะ
ในนั้นบอกว่า 2.0 Beta 3 Public

จากเว็บต้นฉบับ
ไฟล์ที่ต้องแก้ไขโค้ดมีดังนี้
./Sources/Display.php  (เหมือนกัน ไม่มีปัญหา)
./Sources/Post.php  (เหมือนกัน ไม่มีปัญหา)
./Sources/Recent.php  (เหมือนกัน ไม่มีปัญหา)
./Themes/default/Display.template.php  ของเจนไปแก้ในไฟล์ ./Themes/Yabb SE Next Gen/Display.template.php (เหมือนกัน ไม่มีปัญหา)
./Themes/default/Post.template.php  ของเจนไปแก้ในไฟล์  ./Themes/Yabb SE Next Gen/Post.template.php  <<< ของไฟล์นี้มีข้อแตกต่างนิดหน่อย มาขอความช่วยเหลือค่ะ
./Themes/default/languages/Modifications.english.php

ให้ค้นหา
โค๊ด: [Select]
foreach ($context['current_attachments'] as $attachment)
echo '
<input type="checkbox" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '<br />';

แก้เป็น
โค๊ด: [Select]
// Attachment Positioniong Mod: Note, currently using hard coded postmodify vs $context['form'] this should be fixed in the next beta
        foreach ($context['current_attachments'] as $attid => $attachment)
echo '
<input type="checkbox" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), ' <a href="javascript:void(0);" onclick="replaceText(\'[attachment=',($attid+1),']\', document.forms.postmodify.', $context['post_box_name'], '); return false;">[', $txt['attachment_insert'] ,' ', ($attid+1),']</a><br />';

แต่ของเจนเป็น แบบนี้ก็เลยไม่รู้จะใส่ตรงไหนค่ะ

โค๊ด: [Select]
// If this post already has attachments on it - give information about them.
if (!empty($context['current_attachments']))
{
echo '
<dl id="postAttachment">
<dt>
', $txt['attached'], ':
</dt>
<dd class="smalltext">
<input type="hidden" name="attach_del[]" value="0" />
', $txt['uncheck_unwatchd_attach'], ':
</dd>';
foreach ($context['current_attachments'] as $attachment)
echo '
<dd class="smalltext">
<label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '</label>
</dd>';
echo '
</dl>';
}

ส่วนที่ 2 ให้ค้นหา
โค๊ด: [Select]
<input type="file" size="48" name="attachment[]" />';

แก้เป็น
โค๊ด: [Select]
<input type="file" size="48" name="attachment[]" /> <a href="javascript:void(0);" onclick="replaceText(\'[attachment=', (count($context['current_attachments']) + 1) ,']\', document.forms.postmodify.', $context['post_box_name'], '); return false;">[', $txt['attachment_insert'] ,' ', (count($context['current_attachments']) + 1) ,']</a>';

แต่ของเจนเป็น ไม่มีแบบนั้น แต่เป็นแบบนี้ค่ะ
โค๊ด: [Select]
// Is the user allowed to post any additional ones? If so give them the boxes to do it!
if ($context['can_post_attachment'])
{
echo '
<dl id="postAttachment2">
<dt>
', $txt['attach'], ':
</dt>
<dd class="smalltext">
<input type="file" size="60" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';

// Show more boxes only if they aren't approaching their limit.
if ($context['num_allowed_attachments'] > 1)
echo '
<script type="text/javascript"><!-- // --><![CDATA[
var allowed_attachments = ', $context['num_allowed_attachments'], ';
var current_attachment = 1;

function addAttachment()
{
allowed_attachments = allowed_attachments - 1;
current_attachment = current_attachment + 1;
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\' + current_attachment + \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\' + current_attachment + \'\\\');">', $txt['clean_attach'], '</a>)\' + \'</dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');

return true;
}
// ]]></script>
</dd>
<dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';

echo '
<dd class="smalltext">';

ส่วนที่ 3 ให้ค้นหา
โค๊ด: [Select]
function addAttachment()
{
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="48" name="attachment[]" /><span id="moreAttachments"></span>\');
allowed_attachments = allowed_attachments - 1;

return true;
}

แก้เป็น
โค๊ด: [Select]
var count_attachments = ', count($context['current_attachments']) ,' + 1;
function addAttachment()
{
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

count_attachments = count_attachments + 1 ;
setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="48" name="attachment[]" /> <a href="javascript:void(0);" onclick="replaceText(\\\'[attachment=\'+ count_attachments +\']\\\', document.forms.postmodify.', $context['post_box_name'], '); return false;">[', $txt['attachment_insert'] ,' \'+ count_attachments +\']</a> <span id="moreAttachments"></span>\');
allowed_attachments = allowed_attachments - 1;

return true;
}
แต่ของเจน ต่างนิดหน่อย เป็นแบบนี้ ตรงนี้ทับไปได้เลยมั้ยคะ
โค๊ด: [Select]
function addAttachment()
{
allowed_attachments = allowed_attachments - 1;
current_attachment = current_attachment + 1;
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\' + current_attachment + \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\' + current_attachment + \'\\\');">', $txt['clean_attach'], '</a>)\' + \'</dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');

return true;
}

รบกวนดูให้ทีนะค๊า ขอบคุณค่า

ลิงค์หัวข้อ: http://dexmore.com/topic/5735
Windows NT 6.1    Chrome 15.0.874.121   see ip บันทึกการเข้า
http://www.thaitripdd.com
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 2 เมื่อ: 29 พฤศจิกายน 2554, 17:08:33
ส่วนที่ 1
โค๊ด: [Select]
foreach ($context['current_attachments'] as $attachment)

แก้เป็น -->>
โค๊ด: [Select]
foreach ($context['current_attachments'] as $attid => $attachment)

โค๊ด: [Select]
<dd class="smalltext">
<label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '</label>
</dd>';

แก้เป็น -->>
โค๊ด: [Select]
<dd class="smalltext">
<label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '</label>
</dd>';




ส่วนที่ 2
โค๊ด: [Select]
<input type="file" size="60" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';

แก้เป็น -->>
โค๊ด: [Select]
<input type="file" size="60" name="attachment[]" /> <a href="javascript:void(0);" onclick="replaceText(\'[attachment=', (count($context['current_attachments']) + 1) ,']\', document.forms.postmodify.', $context['post_box_name'], '); return false;">[', $txt['attachment_insert'] ,' ', (count($context['current_attachments']) + 1) ,']</a>';



ส่วนที่ 3
โค๊ด: [Select]
function addAttachment()
{
allowed_attachments = allowed_attachments - 1;
current_attachment = current_attachment + 1;
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\' + current_attachment + \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\' + current_attachment + \'\\\');">', $txt['clean_attach'], '</a>)\' + \'</dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');

return true;
}

แก้เป็น -->>
โค๊ด: [Select]
var count_attachments = ', count($context['current_attachments']) ,' + 1;
function addAttachment()
{
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

count_attachments = count_attachments + 1 ;
setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="60" name="attachment[]" /> <a href="javascript:void(0);" onclick="replaceText(\\\'[attachment=\'+ count_attachments +\']\\\', document.forms.postmodify.', $context['post_box_name'], '); return false;">[', $txt['attachment_insert'] ,' \'+ count_attachments +\']</a> <span id="moreAttachments"></span>\');
allowed_attachments = allowed_attachments - 1;

return true;
}

ใช้ In Line Attachments -- ILA ดีกว่านะครับ ลิงค์ดาวน์โหลดทาง PM

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



Thailand   หญิง ออฟไลน์ เว็บไซต์
icon message
general ความคิดเห็นที่ 3 เมื่อ: 30 พฤศจิกายน 2554, 19:45:08
ตกลงคุณ Uncleo หาไฟล์ในเครื่องเจอหรือเปล่าค๊าา ^_^

ส่วนตัวเดิม หลังจากที่แก้ตามที่บอกแล้ว เจนทำเองไม่สำเร็จ มันเพิ่มไฟล์ที่ 2 ที่ 3 ไม่ได้อ่ะค่ะ

เลยรบกวนให้คุณเซียวฯ ช่วยแก้ต่อให้ ปรากฎว่า ตอนนี้ใช้งานได้แต่มีปัญหาว่า

พอเพิ่มจนครบ 4 ไฟล์ตามที่กำหนดไว้

มันยังให้คลิกเพิ่มไฟล์แนบได้อีก พอโพสต์ก็จะฟ้องว่า โพสต์เกิน พอย้อนกลับก็ต้องเริ่มโพสต์ใหม่หมดเลย

ลิงค์หัวข้อ: http://dexmore.com/topic/5735
Windows NT 6.1    Chrome 15.0.874.121   see ip บันทึกการเข้า
http://www.thaitripdd.com
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 4 เมื่อ: 30 พฤศจิกายน 2554, 20:56:51
ลองเอาลิงค์แนบไฟล์เพิ่มออกดูครับ

ตอบยากจริงๆ ครับเรื่องไฟล์แนบไม่เคยใช้ ไม่มีที่ลอง


ไฟล์ในเครื่องหาไม่เจอเลยครับสงสัยลบทิ้งไปแล้ว เดี๋ยวจะลองติดต่อเจ้าของ mod ดูครับได้ผลอย่างไรจะมาแจ้งให้ทราบ

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

Creative Commons License

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

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : 22 พฤษภาคม 2555, 07:52:42

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