插件作者的标准出来了!Manyou诚邀开发者加盟!
“互联网平台开发者”特刊 有奖征集开发者
立即免费下载 Discuz!6.1.0正式版
Discuz! 6.1.0 使用说明
Discuz!NT2.5正式版发布
开放源码下载
UCenter Home 1.2 正式版发布
官方站 | 帮助文档
基于ECShop的网店托管-卖否
北京PHP就业培训热招 | LAMP培训大连
Discuz!收费服务内容及价格
《站长》杂志读者调查表
Discuz!/ECShop 专用官方虚拟主机
Yes玩·快速建立联盟帮助
Comsenz 招聘信息
网店系统ECShop v2.6.0正式版火热发布
基于Discuz!的免费论坛空间5D6D
《站长》第七期:2008SNS进行时
返回列表 发新话题

美化版"鼠标移动到主题显示最后回复内容 for dz5.x"

原作者主题:http://www.discuz.net/viewthread.php?tid=610581
感谢他为大家提供这么好的插件!

有几点他没有做好,最大的问题就是出现的<br><font>等现象。
在此我做一修改,美化一下。
俺只提供5.5的修改方法和修改后的文件。

俺是菜鸟,请不要问我高深的问题。

欢迎大家光临我的小站:http://bbs.hongse.net.cn

==============================================================

名称:鼠标指向主题表格时显示最后回复等内容[修正版置顶、区置顶、总置顶帖无法预览的问题]
功能:与权限挂钩,扩大鼠标反应区域至表格
修改:forumdisplay.php、forumdisplay.htm
美化:枫
版权:归原作者所有

1.修改forumdisplay.php

查找:
isset($ascdesc) && $ascdesc == 'ASC' ? $forumdisplayadd .= '&ascdesc=ASC' : $ascdesc = 'DESC';复制代码
在其下添加:
//----鼠标指向主题表格时显示最后回复等内容--------开始
$dotadd1 = $dotadd2 = '';
if($dotfolders && $discuz_uid) {
    $dotadd1 = "DISTINCT p.authorid AS dotauthor, p.subject AS re_subject, p.message, ";
    $dotadd2 = "LEFT JOIN {$tablepre}posts p ON (t.tid=p.tid AND p.authorid='$discuz_uid')";
}else {
    $dotadd1 = "p.subject AS re_subject, p.message, ";
    $dotadd2 = "LEFT JOIN {$tablepre}posts p ON (t.tid=p.tid AND t.lastpost=p.dateline)";
}
//----鼠标指向主题表格时显示最后回复等内容--------结束
复制代码
查找:
$thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);复制代码
在其下添加:(此为关键步骤,与原作者不同)
//----鼠标指向主题表格时显示最后回复等内容--------开始
if($forum['viewperm'] && !forumperm($forum['viewperm']) && !$forum['allowview']) {
        $thread['message'] = "谢谢您的访问!由于权限不够,您仅可浏览本版主题标题。";
    } elseif($thread['creditsrequire'] && $thread['creditsrequire'] > $credit && !$ismoderator) {
        include language('messages');
        eval("\$show_message = \"".$language[thread_nopermission]."\";");
        $thread['message'] =  $show_message;
    } else {
        $thread['message']  = preg_replace("/\[hide=?\d*\](.+?)\[\/hide\]/is", "**** 回复后才可查看信息 *****", $thread['message'] );
        $thread['message']  = preg_replace("/\[sell=?\d*\](.+?)\[\/sell\]/is", "**** 付費信息,已經隱藏 *****", $thread['message'] );
        $thread['message']  = preg_replace("/\[php](.+?)\[\/php\]/is", "**** 内容为PHP代码 *****", $thread['message'] );
        $thread['message']  = preg_replace("/\[code](.+?)\[\/code\]/is", "**** 内容为普通代码 *****", $thread['message'] );
        $thread['message']  = preg_replace("/\[quote](.+?)\[\/quote\]/is", "**** 内容为引用信息 *****", $thread['message'] );
        $thread['message']  = preg_replace("/\[url=?(.+?)\](.+?)\[\/url\]/is", "**** 此处为超级链接 *****", $thread['message'] );
        $thread['message']  = preg_replace("/\[img](.+?)\[\/img\]/is", "**** 此处为图片链接 *****", $thread['message'] );
        $thread['message'] = str_replace('"', '"', $thread['message']);
        $thread['message'] = str_replace('<', '<', $thread['message']);
        $thread['message'] = str_replace('>', '>', $thread['message']);
        $thread['message'] = str_replace("\r\n", " ", $thread['message']);    //去掉回车换成了空格,紧凑显示
        $thread['message'] = cutstr($thread['message'],240);        //内容截断
        }
    if($thread[replies]) {
        $thread['shortmsg'] = '主题作者: '.$thread[author].'
主题日期: '.$thread[dateline].'
最新回复: '.$thread[lastpost].'
回复数量: '.$thread[replies].' | 查看数量: '.$thread[views].'
回复内容: '.$thread[re_subject].''.$thread[message].''.'';
    } else {
        $thread['shortmsg'] = '主题作者:'.$thread[author].'
主题日期: '.$thread[dateline].'
最新回复: '.$thread[lastpost].'
回复数量: '.$thread[replies].' | 查看数量: '.$thread[views].'
主题内容: '.$thread[message].''.'';
    }
//----鼠标指向主题表格时显示最后回复等内容--------结束
复制代码
如果您安装过全论坛置顶HACK直接进行第二步
如果没有请查找:
$query = $db->query("SELECT t.* FROM {$tablepre}threads t复制代码
把第一个上述代码替换为:
/*$query = $db->query("SELECT t.* FROM {$tablepre}threads t*/
        $query = $db->query("SELECT $dotadd1 t.* FROM {$tablepre}threads t $dotadd2
复制代码
2.修改templates\default\forumdisplay.htm

查找:
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'"复制代码
在='{ALTBG2}'"后面空一格后添加:
title="$thread[shortmsg]"复制代码
3.修改include\javascript\common.js

在最底加入:
document.write("<style type='text/css'>");
document.write(".cPopText { font-family: Tahoma, Verdana; background-color:  #DDEEFF; border: 1px #8899AA dashed; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80); opacity: 0.8;}");

document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000' class='cPopText'></div>")

function showPopupText(event) {
if(event.srcElement) o = event.srcElement; else o = event.target;
if(!o) {
return;
}
MouseX = event.clientX;
MouseY = event.clientY;
if(o.alt != null && o.alt != '') {
o.pop = o.alt;
o.alt = '';
}
if(o.title != null && o.title != '') {
o.pop = o.title;
o.title = '';
}
if(o.pop != sPop) {
sPop = o.pop;
if(sPop == null || sPop == '') {
$('popLayer').style.visibility = "hidden";
} else {
popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
$('popLayer').style.visibility = "visible";
showIt();
}
}
}

function showIt() {
$('popLayer').className = popStyle;
$('popLayer').innerHTML = sPop.replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>");

var bodySL, bodyST;
if(window.pageXOffset){
bodySL=window.pageXOffset;
}else if(document.documentElement&&document.documentElement.scrollLeft){
bodySL=document.documentElement.scrollLeft;
}else if(document.body){
bodySL=document.body.scrollLeft; //author: meizz
}

if(window.pageYOffset){
bodyST=window.pageYOffset;
}else if(document.documentElement&&document.documentElement.scrollTop){
bodyST=document.documentElement.scrollTop;
}else if(document.body){
bodyST=document.body.scrollTop;
}

var bodyCW, bodyCH;
if(window.innerWidth){
bodyCW=window.innerWidth;
}else if(document.documentElement&&document.documentElement.clientWidth){
bodyCW=document.documentElement.clientWidth;
}else if(document.body){
bodyCW=document.body.clientWidth; //author: meizz
}

if(window.innerHeight){
bodyCH=window.innerHeight;
}else if(document.documentElement&&document.documentElement.clientHeight){
bodyCH=document.documentElement.clientHeight;
}else if(document.body){
bodyCH=document.body.clientHeight;
}

if($('popLayer').clientWidth>300){
var popWidth = 300;
}else{
var popWidth = $('popLayer').clientWidth;
}

var popWidth = $('popLayer').clientWidth;
var popHeight = $('popLayer').clientHeight;
var popLeftAdjust = MouseX + 12 + popWidth > bodyCW ? -popWidth - 24 : 0;
var popTopAdjust = MouseY + 12 + popHeight > bodyCH ? -popHeight - 24 : 0;
$('popLayer').style.left = (MouseX + 12 + bodySL + popLeftAdjust) + 'px';
$('popLayer').style.top = (MouseY + 12 + bodyST + popTopAdjust) + 'px';
}

if(!document.onmouseover) {
document.onmouseover = function(e) {
var event = e ? e : window.event;
showPopupText(event);
};
}
复制代码
======================================================================

6月9日增加解决办法:

当你按照上面的方法修改以后,出现下列情况的:

1、在论坛的第一页出现不了最后回复预览,而在第二页就可以出现了;
2、版置顶、区置顶、总置顶的帖子都出现不了最后回复内容预览。

那么请把forumdisplay.php里面的:
$db->query("SELECT t.* FROM {$tablepre}threads t复制代码
全部替换为
$db->query("SELECT $dotadd1 t.* FROM {$tablepre}threads t $dotadd2复制代码
======================================================================

如果你没有更改过上述的三个文件,建议你下载我的压缩包的文件直接覆盖。
附件文件已经更新。

[ 本帖最后由 枫之白衣 于 2007-6-9 18:25 编辑 ]

lastpost.rar (16.83 KB)

lastpost.jpg
建议版主鼓励鼓励。

俺可是第一次在DZ发有关技术的东东
非常郁闷的一件事情:在同一台服务器上,用来测试的小论坛能显示最后回复的内容,我的正式论坛却不能显示最后回复内容,只有除了最后回复内容的其他的信息。。。

演示论坛:http://dz.hongse.net.cn

哪位搭救我呀!

[ 本帖最后由 枫之白衣 于 2007-5-9 00:00 编辑 ]
我的也是...也是无法显示最后回复的内容是什么..都空的..
我的论坛一切正常!不知楼主具体美化在什么地方????
是指这一段
    if($thread[replies]) {
        $thread['shortmsg'] = '主题作者: '.$thread[author].'
主题日期: '.$thread[dateline].'
最新回复: '.$thread[lastpost].'
回复数量: '.$thread[replies].' | 查看数量: '.$thread[views].'
回复内容: '.$thread[re_subject].''.$thread[message].''.'';
    } else {
        $thread['shortmsg'] = '主题作者:'.$thread[author].'
主题日期: '.$thread[dateline].'
最新回复: '.$thread[lastpost].'
回复数量: '.$thread[replies].' | 查看数量: '.$thread[views].'
主题内容: '.$thread[message].''.'';
    }
复制代码


??????
原帖:http://www.discuz.net/viewthread.php?tid=610581

[ 本帖最后由 e_zailai 于 2007-5-9 08:00 编辑 ]
欢迎光临 玫瑰天空个人综合网站
http://www.rosesky.name/bbs/[收藏有大量风格及插件]
其实这一段好看多了..普通就好..

加色太花哨了...

不正常的是无法显示最后回复的内容..
晕,刚测试了一下,竟然打开帖子列表白屏了。

如果您安装过全论坛置顶HACK直接进行第二步
如果没有请查找:

这里的全论坛置顶HACK是哪个哦?不过这一步改没改都一样,还是白屏了。
为什么是白屏哇``````````
楼上的也白屏哈`~~
是的了,迷糊死了```````
又给还原了`
返回列表