主題描述

Home Home
引用 | 編輯 香吉士
2009-09-09 20:21
樓主
推文 x0
【插件資訊】

插件名稱:主題描述
適用版本:7.0
語言編碼:UTF-8
插件作者:tcshek (參考 NSC 的「主題描述 For D4.1」作出改良)
版權所屬:tcshek | 小修改:香吉士
原帖連結:http://www.alan888.com/Discuz/thread-169240-1-4.html###
支持網站:http://allen.ncc.to/viewthread.php?tid=93&extra=page%3D1

【插件說明】

數據升級: 一個
修改檔: ./post.php , ./include/newthread.inc.php , ./include/editpost.inc.php
修改範本: forumdisplay.htm , search_threads.htm, post.htm , viewthread.node.htm
修改語言包:message.lang.php
插件功能簡介: 在標題下加上主題描述。
備注1:轉貼請注明來源與作者。
備注2:由於過程蠻復雜,可能會有地方貼錯,請有問題者提出來討論。
備注3:因為我覺得他原來的不好看,所以小小修改 差不多跟數位男女一樣了 表情
範例:



修改開始








MYSQL:後台資料庫升級
複製程式
ALTER TABLE `cdb_threads` ADD `description` CHAR( 80 ) DEFAULT NULL AFTER `subject` ;









第一步:打開./post.php
搜索:複製程式
$subject = isset($subject) ? dhtmlspecialchars(censor(trim($subject))) : '';

下面加:複製程式
$description = isset($description) ? dhtmlspecialchars(censor(trim($description))) :'';

搜索:複製程式
 $subject = !empty($subject) ? str_replace("\t", ' ', $subject) : $subject;

下面加:$description = stripslashes($description);






第二步:打開./include/newthread.inc.php
搜索:複製程式
        if(!$sortid && !$special && $message == '') { 
                showmessage('post_sm_isnull'); 
        }

下面加:複製程式
               if(strlen(htmlspecialchars($description)) > 60) { 
                                showmessage('post_description_toolong'); 
                 } 

搜索: (搜尋第一個.第二個不要)
下面這個部份
db->query("INSERT INTO {$tablepre}threads (fid, readperm, price, iconid, typeid, sortid, author, authorid, subject,
複製程式
 authorid, subject, 

替代:複製程式
 authorid, subject, description,

搜索: (搜尋第一個.第二個不要)
下面這個部份
VALUES ('$fid', '$readperm', '$price', '$iconid', '$typeid', '$sortid', '$author', '$discuz_uid', '$subject',
複製程式
 '$discuz_uid', '$subject',

替代:複製程式
 '$discuz_uid', '$subject', '$description',









文件-第三步:打開./include/editpost.inc.php
搜索:複製程式
if(!submitcheck('editsubmit')) { 

下面加:複製程式
     if($isfirstpost) { 
        $query = $db->query("SELECT description FROM {$tablepre}threads WHERE tid='$tid' AND fid='$fid'"); 
        $threadinfo = $db->fetch_array($query); 
    }

搜索:複製程式
$postinfo['subject'] = str_replace('"', '"', $postinfo['subject']); 

下面加:複製程式
$threadinfo['description'] = str_replace('"', '"', $threadinfo['description']); 

搜索:複製程式
                         if(!$sortid && !$thread['special'] && $message == '') { 
                                showmessage('post_sm_isnull'); 
                        }

下面加:複製程式
                                                 if(strlen(htmlspecialchars($description)) > 60) { 
                                                                 showmessage('post_description_toolong'); 
                                                }

搜索:複製程式
 subject='$subject',

在這句之後加上:複製程式
description='$description', 








模版-第一步:打開./templates/default/forumdisplay.htm
搜索:複製程式
                                                         <!--{if $thread['new']}--> 
                                                                <a href="redirect.php?tid=$thread[tid]&goto=newpost$highlight#newpost" class="new">New</a> 
                                                        <!--{/if}-->

在之後加上:複製程式
$thread[multipage]<br><span style="color:#006600 "><FONT size=1><P align=right>$thread[description]</P></FONT></span> 

**   size= 可以調 我是條1  圖說:
上面的 color:#006600 這裡設成綠色,你可以改成你想要的顏色、<P align=right>看你要靠哪一邊? 我試設右邊(因為跟數位男女一樣)圖說:






模版-第二步:打開./templates/default/search_threads.htm

搜索:複製程式
 <!--{if $thread[multipage]}--><span class="threadpages">$thread[multipage]</span><!--{/if}-->

整段替換成:複製程式
<!--{if $thread[multipage]}--><SPAN class=threadpages>$thread[multipage]<BR><SPAN style="COLOR: #C0C0C0">$thread[description]</SPAN></SPAN><!--{/if}--> 







模版-第三步:打開./templates/default/viewthread.node.htm

搜索: 複製程式
 $thread[subject]

在這句之後加上:複製程式
 <br><FONT color=#009900>$thread[description]</FONT>

圖說:





模版-第四步:打開./templates/default/post.htm

搜索:複製程式
<!--{if !empty($modelid) && $threadsorts[modelid][$tsortid] == $modelid || empty($modelid)}--> 
                                                                <option value="$tsortid"{if $sortid == $tsortid} selected="selected"{/if}>{echo strip_tags($name);}</option> 
                                                        <!--{/if}--> 
                                                <!--{/loop}--> 
                                                </select> 
                                        </div> 
                                        <!--{/if}--> 

在下面加上:複製程式
<div class="altbg1" width="20%" align=left>副標題(可免填):<input type="text" name="description" size="50" value=" $threadinfo[description] " tabindex="4"></div> 

size="50" 依個人喜好調整  圖說:




語言包-第一步:打開./templates/default/messages.lang.php

搜索:複製程式
 'post_subject_toolong' => '對不起,您的標題超過 80 個字符,請返回修改標題長度。',

在下面加上:複製程式
 'post_description_toolong' => '對不起,您的主題描述超過 80 個字元,請返回修改描述長度。', 






更新緩存OK!


反安裝數據
複製程式
 ALTER TABLE `cdb_threads` DROP `description` ;




範例:


獻花 x1