插件作用:在首页显示每个版块最新回复主题的标题,并截取适当的字符不使其撑开表格影响美观!
首页显示这些标题无疑会增加浏览者的浏览欲望!
说 明:这个插件以前好像有过,这几天找不到,就自己做个一个,如果有雷同请勿追究!
适用版本:Discuz! 5。0正式版
插件作者:tmjob
修改文件:include/forum.func.php、templates/default/discuz.htm模板
安装难易:简
演 示:http://www.tmjob.cn
提醒:先进行备份,养成良好习惯否则出问题请不要找我
一、修改 forum.func.php
查找:
- list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost
- ['author']) = is_array($forum['lastpost']) ? $forum['lastpost'] : explode("\t", $forum
- ['lastpost']);
复制代码
在后面添加:
- //首页显示最后发表标题by tmjob.cn
- $lastpost['subject1'] = cutstr($lastpost['subject'], 20, $dot = ' ...');
- //首页显示最后发表标题by tmjob.cn
复制代码
说明:其中的20是指截取的字符长度,可以自行修改!
二、修改 discuz.htm
查找:
- <td align="center" title="{lang forum_lastpost_in}: {$forum[lastpost][subject]}" nowrap>
- <span class="smalltxt"><a href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost">$forum[lastpost][dateline]</a></span><br>{lang forum_lastpost_by}
复制代码
全部替换为
- <!--首页显示最后发表标题by tmjob.cn-->
- <td align="left" nowrap><span class="smalltxt">
- <a href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost" title="{lang forum_lastpost_in}: {$forum[lastpost][subject]}">{lang forum_lastpost_in}: $forum[lastpost][subject1]</a><br>
- $forum[lastpost][dateline]</span><br>
- {lang forum_lastpost_by}
- <!--首页显示最后发表标题by tmjob.cn-->
复制代码
**结束**
注 在主题前面不要显示 标题 个字
则第二步替换为:
- <!--首页显示最后发表标题by tmjob.cn-->
- <td align="left" nowrap><span class="smalltxt">
- <a href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost" title="{lang forum_lastpost_in}: {$forum[lastpost][subject]}">$forum[lastpost][subject1]</a><br>
- $forum[lastpost][dateline]</span><br>
- {lang forum_lastpost_by}
- <!--首页显示最后发表标题by tmjob.cn-->
复制代码
有什么问题和建议尽管提出!
有人安装说一声哦~~
[ 本帖最后由 tmjob 于 2006-10-15 15:38 编辑 ] |