Page 1 of 1

[RC] Buttons menu MOD 2.3.0 + subsilver2 เพิ่ม buttom menu แบบ side

Posted: 04/06/2013 7:40 pm
by M004
รายละเอียดเกี่ยวกับ [RC] Buttons menu MOD 2.3.0 + subsilver2
mod นี้ เราสามารถเพิ่ม button menu บริเวณ header

พัฒนาโดย : Kamahl
Version : 2.3.0
phpBB Version(s) : phpbb3.0.11
ดาวน์โหลดได้ที่ : https://www.phpbb.com/community/viewtop ... &t=1116985
1.jpg
1.jpg (14.18 KiB) Viewed 613 times
2.jpg
2.jpg (29.36 KiB) Viewed 613 times
3.jpg
3.jpg (15.96 KiB) Viewed 613 times
4.jpg
4.jpg (43.72 KiB) Viewed 613 times
ขั้นตอนติดตั้ง
เปิดไฟล์ includes/constants.php
ค้นหา

Code: Select all

// Additional tables
เติมหลัง

Code: Select all

define('MENU_BUTTONS_TABLE', $table_prefix . 'menu_buttons');
define('MENU_COLORS_TABLE', $table_prefix . 'menu_colors'); 
เปิดไฟล์ includes/functions.php
ค้นหา

Code: Select all

        'A_COOKIE_SETTINGS'        => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')),
    )); 
เติมหลังคำค้นหา

Code: Select all

  // Buttons menu MOD
  if ( isset($config['menu_enabled']) && $config['menu_enabled'] )
  {
    $sql = 'SELECT *
              FROM ' . MENU_COLORS_TABLE . '
                WHERE color_style_id = ' . $user->theme['style_id'];
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);

    if ($db->sql_affectedrows())
    {
      $template->assign_vars(array(
        'S_MENU_COLOR'              => $row['color_name'],
        'S_MENU_FONT_COLOR'         => $row['color_text'],
        'S_MENU_FONT_COLOR_HOVER'   => $row['color_text_hover'],
        'S_MENU_DECORATION'         => $row['color_text_hover_decor'],
        'S_MENU_WEIGHT'             => $row['color_text_weight'],
        'S_MENU_SEARCH'             => $row['color_display_search'],
        'S_MENU_TEXT_TRANSFORM'     => $row['color_text_transform'],
        'S_MENU_ALIGN'              => $row['color_align'],
      ));

      $sql = 'SELECT *
              FROM ' . MENU_BUTTONS_TABLE . '
                WHERE button_display = 1
                  AND parent_id = 0
                ORDER BY left_id';
      $result = $db->sql_query($sql);

      while ($row = $db->sql_fetchrow($result))
      {
        if ( ($row['button_only_registered'] && $user->data['user_id'] == ANONYMOUS) || ($row['button_only_guest'] && $user->data['user_id'] != ANONYMOUS) )
        {
          continue;
        }

                if (preg_match("/\{(.*)\}/", $row['button_url']))
                {
                    $brackets = array("{", "}");
                    $var_name = strtoupper(str_replace($brackets, '', $row['button_url']));
                    $row['button_url'] = $template->_rootref[$var_name];
                }

                if (preg_match("/\{(.*)\}/", $row['button_name']))
                {
                    $brackets = array("{L_", "}");
                    $var_name = strtoupper(str_replace($brackets, '', $row['button_name']));
                    $row['button_name'] = $user->lang[$var_name];
                }

        $template->assign_block_vars('buttons', array(
          'ID'                => $row['button_id'],
          'URL'               => $row['button_url'],
          'NAME'              => $row['button_name'],
          'EXTERNAL'          => $row['button_external'],
        ));

        $sub_sql = 'SELECT *
                    FROM ' . MENU_BUTTONS_TABLE . '
                      WHERE button_display = 1
                        AND parent_id = ' . $row['button_id'] . '
                      ORDER BY left_id';
        $sub_result = $db->sql_query($sub_sql);

        while ($sub_row = $db->sql_fetchrow($sub_result))
        {
          if ( ($sub_row['button_only_registered'] && $user->data['user_id'] == ANONYMOUS) || ($sub_row['button_only_guest'] && $user->data['user_id'] != ANONYMOUS) )
          {
            continue;
          }

                     if (preg_match("/\{(.*)\}/", $sub_row['button_url']))
                    {
                        $brackets = array("{", "}");
                        $var_name = strtoupper(str_replace($brackets, '', $sub_row['button_url']));
                        $sub_row['button_url'] = $template->_rootref[$var_name];
                    }

                    if (preg_match("/\{(.*)\}/", $sub_row['button_name']))
                    {
                        $brackets = array("{L_", "}");
                        $var_name = strtoupper(str_replace($brackets, '', $sub_row['button_name']));
                        $sub_row['button_name'] = $user->lang[$var_name];
                    }

          $template->assign_block_vars('buttons.sub', array(
            'ID'                => $sub_row['button_id'],
            'URL'               => $sub_row['button_url'],
            'NAME'              => $sub_row['button_name'],
            'EXTERNAL'          => $sub_row['button_external'],
          ));
        }
        $db->sql_freeresult($sub_result);
      }
      $db->sql_freeresult($result);
    }
  } 
เปิดไฟล์ styles/prosilver/template/overall_header.html
ค้นหา

Code: Select all

</head>
เติมก่อนค้นหา

Code: Select all

<style type="text/css">
  #menu ul li a {
  	color: #{S_MENU_FONT_COLOR};
  }
  #menu ul li a:hover {    
    background: url('{T_THEME_PATH}/images/menu/{S_MENU_COLOR}/menu_bg_hover.gif') repeat-x;
    color: #{S_MENU_FONT_COLOR_HOVER};
    text-decoration: {S_MENU_DECORATION};  	
  }
  #menu ul ul li {
    background: url('{T_THEME_PATH}/images/menu/{S_MENU_COLOR}/menu_subbg.gif') repeat-x;
  }
  #menu ul ul li a:hover {    
    background: url('{T_THEME_PATH}/images/menu/{S_MENU_COLOR}/menu_subbg_hover.gif') repeat-x;
  }
</style>
ค้นหา
<!-- IF S_DISPLAY_SEARCH and not S_IN_SEARCH -->
เติมแทน

Code: Select all

<!-- IF ( S_DISPLAY_SEARCH and not S_IN_SEARCH ) and not ( .buttons and S_MENU_SEARCH ) -->
ค้นหา

Code: Select all

				</fieldset>
				</form>
			</div>
		<!-- ENDIF -->
เติมหลัง

Code: Select all

    <!-- IF .buttons -->
      <span class="corners-bottom" style="height:0px;"><span style="display: none;"></span></span></div>
    </div>
    <div id="menu" style="clear:both;margin-top:-3px;background: url('{T_THEME_PATH}/images/menu/{S_MENU_COLOR}/menu_bg.gif') repeat-x;">
    	<div class="inner">
    	<span class="menu_corner-left" style="background: url('{T_THEME_PATH}/images/menu/{S_MENU_COLOR}/menu_corner.gif') no-repeat;"></span>
    	<span class="menu_corner-right" style="background: url('{T_THEME_PATH}/images/menu/{S_MENU_COLOR}/menu_corner_right.gif') no-repeat;"></span>
    <!-- IF S_DISPLAY_SEARCH and S_MENU_SEARCH -->
    	<div id="top-search" style="<!-- IF S_MENU_ALIGN == 'right' -->float: left;<!-- ELSE -->float: right;<!-- ENDIF -->background: transparent url('{T_THEME_PATH}/images/menu/{S_MENU_COLOR}/menu_search.gif') no-repeat scroll 0 0;">
    		<form action="{U_SEARCH}" method="post" id="search">
    		<fieldset>
    			<input name="keywords" id="keywords" type="text" maxlength="128" title="{L_SEARCH_KEYWORDS}" class="menu_search" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" /> 
    			{S_SEARCH_HIDDEN_FIELDS}
    		</fieldset>
    		</form>
    	</div>
    <!-- ENDIF -->
    	<ul>
    	<!-- BEGIN buttons -->
    		<li style="float:{S_MENU_ALIGN};"<!-- IF .buttons.sub --> onmouseover="getElementsByTagName('ul')[0].style.display = 'block';" onmouseout="getElementsByTagName('ul')[0].style.display = 'none';"<!-- ENDIF -->>
          <a href="{buttons.URL}" title="{buttons.NAME}"<!-- IF buttons.EXTERNAL --> target="_blank"<!-- ENDIF --> style="font-weight:{S_MENU_WEIGHT};text-transform:{S_MENU_TEXT_TRANSFORM};">{buttons.NAME}</a>
          <!-- IF .buttons.sub -->
            <ul>
              <!-- BEGIN sub --><li><a href="{sub.URL}" title="{sub.NAME}"<!-- IF sub.EXTERNAL --> target="_blank"<!-- ENDIF --> style="font-weight:{S_MENU_WEIGHT};text-transform:{S_MENU_TEXT_TRANSFORM};">{sub.NAME}</a></li><!-- END sub -->
          	</ul>
        	<!-- ENDIF -->
        </li>
      <!-- END buttons -->
    	</ul>
    <!-- ENDIF -->
ค้นหา

Code: Select all

				<li class="icon-faq"><a href="{U_FAQ}" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a></li>
เติมหลัง

Code: Select all

				<!-- IF .buttons and S_MENU_SEARCH --><li class="icon-search"><a href="{U_SEARCH}" title="{L_SEARCH_ADV_EXPLAIN}">{L_SEARCH}</a></li><!-- ENDIF -->
เปิดไฟล์ styles/prosilver/theme/stylesheet.css
ค้นหา

Code: Select all

@import url("colours.css");
เติมหลัง

Code: Select all

@import url("menu.css");
ติดตั้งไฟล์

Code: Select all

install_buttons_menu.php