返回列表

[Discuz!] 如何设置彩色的主题分类名称

1.进论坛后台,点需要设置的版块后面的“编辑”,其他》主题分类,启用主题分类:是,点击“添加分类”,输入分类名称点提交。
QQ20141106-2.jpg
2014-11-6 12:36

2.前台发帖的时候就可以选择设置好的主题分类了。
QQ20141106-1.jpg
2014-11-6 12:36


3.分类名称设置颜色可以在分类名称写如下代码(其他颜色自己翻译哦):
  1. <font color=red>红色主题分类名称</font>
复制代码
  1. <font color=blue>蓝色主题分类名称</font>
复制代码
  1. <font color=green>绿色主题分类名称</font>
复制代码




效果参考http://www.discuz.net/forum-2-1.html


有的站长想连括号[]都设置颜色,那么需要对模板进行修改才可以,其实就是去掉了[]
1.帖子查看页需要修改template/default/forum/viewthread.htm,如果不是模板需要把default换成模板目录名称
第188行
  1. <h1 class="ts">
  2.                                         <!--{if $_G['forum_thread']['typeid'] && $_G['forum']['threadtypes']['types'][$_G['forum_thread']['typeid']]}-->
  3.                                                 <!--{if !IS_ROBOT && ($_G['forum']['threadtypes']['listable'] || $_G['forum']['status'] == 3)}-->
  4.                                                         <a href="forum.php?mod=forumdisplay&fid=$_G[fid]&filter=typeid&typeid=$_G[forum_thread][typeid]">[{$_G['forum']['threadtypes']['types'][$_G['forum_thread']['typeid']]}]</a>
  5.                                                 <!--{else}-->
  6.                                                         [{$_G['forum']['threadtypes']['types'][$_G['forum_thread']['typeid']]}]
  7.                                                 <!--{/if}-->
  8.                                         <!--{/if}-->
  9.                                         <!--{if $threadsorts && $_G['forum_thread']['sortid']}-->
  10.                                                 <a href="forum.php?mod=forumdisplay&fid=$_G[fid]&filter=sortid&sortid=$_G[forum_thread][sortid]">[{$_G['forum']['threadsorts']['types'][$_G['forum_thread']['sortid']]}]</a>
  11.                                         <!--{/if}-->
  12.                                         <span id="thread_subject">$_G[forum_thread][subject]</span>
复制代码

修改为
  1. <h1 class="ts">
  2.                                         <!--{if $_G['forum_thread']['typeid'] && $_G['forum']['threadtypes']['types'][$_G['forum_thread']['typeid']]}-->
  3.                                                 <!--{if !IS_ROBOT && ($_G['forum']['threadtypes']['listable'] || $_G['forum']['status'] == 3)}-->
  4.                                                         <a href="forum.php?mod=forumdisplay&fid=$_G[fid]&filter=typeid&typeid=$_G[forum_thread][typeid]">{$_G['forum']['threadtypes']['types']
  5. [$_G['forum_thread']['typeid']]}</a>
  6.                                                 <!--{else}-->
  7.                                                         {$_G['forum']['threadtypes']['types'][$_G['forum_thread']['typeid']]}
  8.                                                 <!--{/if}-->
  9.                                         <!--{/if}-->
  10.                                         <!--{if $threadsorts && $_G['forum_thread']['sortid']}-->
  11.                                                 <a href="forum.php?mod=forumdisplay&fid=$_G[fid]&filter=sortid&sortid=$_G[forum_thread][sortid]">{$_G['forum']['threadsorts']['types'][$_G['fo
  12. rum_thread']['sortid']]}</a>
  13.                                         <!--{/if}-->
  14.                                         <span id="thread_subject">$_G[forum_thread][subject]</span>
复制代码



2.主题列表页需要修改source/module/forum/forum_forumdisplay.php,
第636行
  1. $thread['typehtml'] = '<em>[<a href="forum.php?mod=forumdisplay&fid='.$_G['fid'].'&amp;filter=typeid&amp;typeid='.$thread['typeid'].'">'.$_G['forum']['threadtypes']['types'][$thread['typeid']].'</a>]</em>';
复制代码

修改为
  1. $thread['typehtml'] = '<em><a href="forum.php?mod=forumdisplay&fid='.$_G['fid'].'&amp;filter=typeid&amp;typeid='.$thread['typeid'].'">'.$_G['forum']['threadtypes']['types'][$thread['typeid']].'</a></em>';
复制代码


3.主题分类的名称加上括号,这样就完美实现主题分类括号带颜色啦,如:
  1. <font color=red>[红色主题分类名称]</font>
复制代码

返回列表