使用版本:phpBB 2.0.4
來源網址: http://phpbb-tw.net/phpbb/viewtopic.php?t=15805
Mac 寫:下載: http://www.phpbbhacks.com/viewhack.php?id=1366
lang_main.php代碼: 選擇全部
################################################################################### ## ## Hack Title: Add a new field to posting part 增添一個新欄位在發表文章的頁面\r ## Hack Version: 1.0.1 (phpBB 2.0.4 or lower) ## Author: Acid ## 中文化: Mac < ycl_6@sinamail.com > ## Support: http://www.phpbbhacks.com/forums/ ## ## Description: An example how you can add a new field to the posting part... ## ..it will be displayed above the post (post view) and below ## topic title (topic view). ## 在發表文章時增加主題描述(或任何你想要的用途) ## 增添的訊息將顯示在 viewtopic.php & viewforum.php ## ## Files to edit: 9 ## language/lang_english/lang_main.php ## includes/functions_post.php ## includes/topicreview.php ## posting.php ## viewtopic.php ## viewforum.php ## templates/xxx/posting_body.tpl ## templates/xxx/posting_preview.tpl ## templates/xxx/posting_topicreview.tpl ## templates/xxx/viewtopic_body.tpl ## templates/xxx/viewforum_body.tpl ## ################################################################################### ## ## Installation/Author Notes: ## First always make a backup from the files/database that you're going to edit. ## ## This hack adds new new fields to your database. ## ## If you want to add another fields to the posting part, just duplicate the ## following actions and rename the label (but be aware of the spelling like 'extra', ## 'post_extra' or 'EXTRA' etc.) ## ################################################################################### ## Versions: ## ## 1.0.1 - fixed some language/template bugs ## 1.0 - Release ################################################################################### ## SQL QUERY: (You may have to change your database prefix) ALTER TABLE test_topics ADD topic_extra CHAR(60) NOT NULL AFTER topic_title; ALTER TABLE test_posts_text ADD post_extra VARCHAR(60) DEFAULT NULL AFTER post_subject; ## alternate you can use table_update.php to alter the database ## automatically (just upload and run the file) ###################################################################################
[php]<?php
$lang['Extra'] = '額外資訊';
$lang['Empty_extra'] = '沒有填入額外訊息?';
$lang['Post_extra'] = '額外資訊:';
?>[/php]
修正(http://www.phpbbhacks.com/forums/viewtopic.php?t=10193)
posting.php~Mac代碼: 選擇全部
尋找: $extra = $post_info['topic_extra']; 換成: $extra = $post_info['post_extra'];
我的問題所在
我把 templates/xxx/posting_body.tpl 內的以下:
代碼: 選擇全部
<input type="text" name="extra" size="45" maxlength="60" style="width:450px" tabindex="2" class="post" value="{EXTRA}" />
代碼: 選擇全部
<textarea type="text" name="extra" wrap="virtual" rows="4" cols="35" style="width:420px" tabindex="3" class="post" />{EXTRA}</textarea>