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

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

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: มาทำ menu ผลุบ-โผล่กันเถอะ  (อ่าน 1410 ครั้ง)
0 สมาชิก และ 1 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general เมื่อ: 2 กุมภาพันธ์ 2553, 21:35:51
  • ชื่อ: Slide Menu
  • ผู้เขียน: UnclEo
  • นำเสนอโดย: DexMoreGroup
  • ประเภท: Theme Enhancements
  • รองรับ: SMF 1.1.xx
  • ปรับปรุงล่าสุด: 23 มิถุนายน 2553

รายละเอียด
      หลาย ๆ ท่านอาจจะเบื่อ menu แบบเดิม ๆ พอดีไปเห็น Themes  extreme61 เป็น menu น่าสนใจดีก็เลยแงะมาฝาก SFM corner กัน เอาธีมมาตรฐานนะครับ ธีมอื่น ๆ ก็ใช้ได้เหมือนกัน แต่โค๊ดที่หาอาจไม่เหมือนกัน ท่านที่ใช้ธีมอื่น แล้วหาโค๊ดไม่เจอ ก็เอาไฟล์นี้มาดูกันนะครับ ถ้าโพสในกระทู้ขอให้โพสเป็นโค๊ด นะครับ

ตัวอย่าง



เริ่มต้นกันที่ไฟล์ index.template.php (ไฟล์เดียวแหละ)  Grin

ค้นหา -->>
โค๊ด: [Select]
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/mootools.js"></script>
<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/imagemenu.js"></script>
<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/imagemenu2.js"></script>

ค้นหา -->>
โค๊ด: [Select]
// Show the menu here, according to the menu sub template.
template_menu();

แก้เป็น -->>
โค๊ด: [Select]
<div id="toolbar">',template_menu(),'</div>

ค้นหา -->>
โค๊ด: [Select]
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;

// Work out where we currently are.
$current_action = 'home';
if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
$current_action = 'admin';
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';

// Are we using right-to-left orientation?
if ($context['right_to_left'])
{
$first = 'last';
$last = 'first';
}
else
{
$first = 'first';
$last = 'last';
}

// Show the start of the tab section.
echo '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="maintab_' , $first , '">&nbsp;</td>';

// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
</td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// How about the [search] button?
if ($context['allow_search'])
echo ($current_action == 'search' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'search' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=search">' , $txt[182] , '</a>
</td>' , $current_action == 'search' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo ($current_action == 'admin' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'admin' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>
</td>' , $current_action == 'admin' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'profile' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
</td>' , $current_action == 'profile' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>
</td>' , $current_action == 'pm' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The [calendar]!
if ($context['allow_calendar'])
echo ($current_action == 'calendar' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'calendar' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>
</td>' , $current_action == 'calendar' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
</td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'login' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=login">' , $txt[34] , '</a>
</td>' , $current_action == 'login' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'register' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
</td>' , $current_action == 'register' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'logout' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
</td>' , $current_action == 'logout' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The end of tab section.
echo '
<td class="maintab_' , $last , '">&nbsp;</td>
</tr>
</table>';

}

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

file style.css

หา -->>
โค๊ด: [Select]
/* The AJAX notifier */
#ajax_in_progress {
background: #002962;
color: white;
text-align: center;
font-weight: bold;
font-size: 18pt;
padding: 3px;
width: 100%;
position: fixed;
top: 0;
left: 0;
}

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
#toolbar {
height: 70px;
background: #000000 url(images/mootools_03.png) repeat-x;
margin-left: 9px;
margin-right: 9px;

}

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
#kwick {
width : 100%;
}
#kwick .kwicks {
background : transparent;
display : block;
height : 70px;
margin : 0;
padding : 0;
}
#kwick li {
float : left;
margin : 0;
padding : 0;
list-style : none;
}
#kwick .kwick {
display : block;
cursor : pointer;
overflow : hidden;
height : 70px;
width : 78px;
}
#kwick .kwick span {
display : none;
}
#kwick .opt0 {
background-color : transparent;
outline : none;
}
#kwick .opt1 {
background-color:transparent;
outline: none
}

#kwick .opt2 {
background-color:transparent;
outline: none
}

#kwick .opt3 {
background-color:transparent;
outline: none
}

#kwick .opt4 {
background-color:transparent;
outline: none
}

#kwick .opt5 {
background-color:transparent;
outline: none
}

#kwick .opt6 {
background-color:transparent;
outline: none;
}

#kwick .opt7 {
background-color:transparent;
outline: none
}

#kwick .opt8 {
background-color:transparent;
outline: none
}

#kwick .opt9 {
background-color:transparent;
outline: none
}

#kwick .opt10 {
background-color:transparent;
outline: none
}

#kwick .opt11 {
background-color:transparent;
outline: none
border-right: 0px none;
}

ดาวน์โหลดรูปครับ
แตกไฟล์แล้วอัฟโหลดรูปทั้งหมดไปไว้ใน $Themesdir/default/images/thai-utf8

ดาวน์โหลดอีกไฟล์ครับ ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com

ไฟล์นี้เป็นไฟล์ *.psd ครับเอาไว้ให้ท่านแก้ไขกราฟิก เปลี่ยนรูแบบสีสรรของ menu ตามใจชอบ

ดาวน์โหลดอีกทีครับ ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com

อันนี้เป็น javaScript + mootools ครับทั้งหมด 3 ไฟล์ แตกไฟล์แล้วเอาไปไว้ใน $Themesdir ใช้ธีมใหนไว้ธีมนั้นนะครับ

##อธิบายโค๊ดแต่ละส่วนคร่าว ๆ นะครับ
โค๊ด: [Select]
<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/mootools.js"></script>
<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/imagemenu.js"></script>
<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/imagemenu2.js"></script>
นี่คือการเรียกไฟล์ทั้ง 3 ไฟล์มาใช้งานครับ ให้สังเกตุที่ .js นั่นคือ javaScript ทั้ง 3 ไฟล์

ส่วนที่ 2
โค๊ด: [Select]
<div id="kwick">
คือการเรียกใช้งาน #kwick จาก style.css ที่เราเพิ่มไว้ครับ

ส่วนที่ 3
โค๊ด: [Select]
<div id="toolbar">',template_menu(),'</div>
เป็นการเรียกใน #toolbar ที่เราเพิ่มใน style.css เหมือนกัน menu จะอยู่ใน id นี้ เราสามารถเปลียนขนาด พื้นหลังได้ตามใจชอบ
แต่ต้องสอดคล้องกับ #kwick

ส่วนที่ 4
โค๊ด: [Select]
// Show the [home] button.
echo '<li><a href="', $scripturl, '" class="kwick opt1">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.png" alt="' . $txt[103] . '" style="margin: 0px 0;" border="0" /><span>' : $txt[103]), '</span></a></li>';

      นี่คือส่วนของปุ่ม [button]ที่เราสามารถเพิ่มหรือ ลดได้ตามความต้องการ เราจะให้ลิงค์ไปทีใหนก็เปลี่ยนที่ a href="', $scripturl, อันนี้คือลิงค์หน้าแรกของบอร์ด ส่วนรูปเราก็เปลี่ยนได้ตามความต้องการโดยเปลี่ยนที่ home.png ยกให้เป็นตัวอย่างนะครับ ที่สำคัญจำนวน kwick opt1 ใน รายการปุ่ม
นี้จะต้องเท่ากันกับใน style.css นะครับ มันจะมีตั้งแต่ kwick opt1 - kwick opt11 ถ้าในรายการเมนูนี้มีถึง 12 เราก็ต้องเพิ่ม kwick opt12 ใน style.css ด้วย ใน style.css จะมีน้อยกว่าในรายการ menu ไม่ได้ แต่มีมากกว่าได้

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

Creative Commons License

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

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : 16 พฤษภาคม 2555, 20:23: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