森林之原
五月 23, 2012, 12:42:34 am *
歡迎光臨, 訪客. 請先 登入註冊一個帳號.

請輸入帳號, 密碼以及預計登入時間
新聞: CPG 1.4.3 繁體中文完成,請到 CPG 的版面下載。
 
   首頁   說明 搜尋 日曆 登入 註冊  
頁: [1]   向下
  寄送主題  |  列印  
作者 主題: 如何新增頁籤 (tab)  (閱讀 4476 次)
0 會員 以及 2 訪客 正在閱讀本篇主題.
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 於: 一月 02, 2006, 05:42:27 am »

如何新增頁籤 (tab)

新版的 SMF 加上了新的佈景,現在預設的佈景跟之前的很不相同。
選單也都改成了頁籤的方式,代替了之前使用的圖示按鈕。
如果你要新增頁籤,譬如說加上 "相簿" 的連結,可以照下面的方式。

第一步:
打開 index.template.php
尋找:
程式碼:
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
改成:
程式碼:
    if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'gallery')))
你可以看到最後面加上了 gallery。

第二步:
相同檔案 index.template.php
尋找:
程式碼:
    // 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>' : '';
將上面的代碼複製,然後貼到你要顯示的地方,例如在上面的代碼後面。
然後將裡面的 home 改成 gallery,如同下面 (共有三個):
程式碼:
    // Show the [gallery] button.
echo ($current_action=='gallery' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'gallery' ? 'active_back' : 'back' , '">
<a href="http://website.com/gallery">相簿</a>
</td>' , $current_action == 'gallery' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
$current_action=='gallery' 裡的 gallery 必須跟第一步裡改的一樣。
接下來要改連結的位置,將上面的 http://website.com/gallery 改成你相簿的網址。

你也可以把 "相簿" 放在中文檔裡。
打開 index.chinese-traditional-utf8.php 或 index.chinese-traditional-big5.php。
然後到最下面把 $txt[my_gallery] 放在 ?> 之前。
例如:
程式碼:
$txt[my_gallery] = '相簿';

?>
如果是用這個方法,記得連結的那行要改:
程式碼:
<a href="http://website.com/gallery">', $txt[my_gallery], '</a>

如果遇到問題請回覆。


來源:http://www.simplemachines.org/community/index.php?topic=63203.0
向版主檢舉   已記錄

頁: [1]   向上
  寄送主題  |  列印  
 
前往:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006, Simple Machines LLC Valid XHTML 1.0! Valid CSS!