您现在的位置是:首页 > cms教程 > Discuz教程Discuz教程
Discuz首页四格插件使用方法
敦厦2025-07-19Discuz教程已有人查阅
导读第一步:上传相关文件:包含文件:pic.php 请上传至论坛根目录images目录 请将目录下的文件(两个图片一个FLASH)上传到论坛images目录下第二步:修改index.php(修改前请先备份,出错时可以恢复)
第一步:上传相关文件:
包含文件:
pic.php 请上传至论坛根目录
images目录 请将目录下的文件(两个图片一个FLASH)上传到论坛images目录下
第二步:修改index.php(修改前请先备份,出错时可以恢复)
查找
查找:
包含文件:
pic.php 请上传至论坛根目录
images目录 请将目录下的文件(两个图片一个FLASH)上传到论坛images目录下
第二步:修改index.php(修改前请先备份,出错时可以恢复)
查找
$rsshead = $rssstatus
在其上加入如下代码:
//----首页多格代码开始
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
//新贴
$hack_cut_str = 26; //标题字数
$hack_cut_strauthor = 9;
$new_post_threadlist = array();
$nthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND f.fid not in (0) AND t.displayorder not in (-1,-2) AND f.fid !=22 ORDER BY t.dateline DESC LIMIT 0, 10");
while($nthread = $db->fetch_array($query)) {
$nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
$nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
$nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
if($nthread['highlight']) {
$string = sprintf('d', $nthread['highlight']);
$stylestr = sprintf('b', $string[0]);
$nthread['highlight'] = 'style="';
$nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$nthread['highlight'] .= '"';
} else {
$nthread['highlight'] = '';
}
$new_post_threadlist[] = $nthread;
}
//新回复
$hack_cut_str = 26; //标题字数
$hack_cut_strauthor = 9;
$new_reply_threadlist = array();
$rthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 AND f.fid not in (0) AND t.displayorder not in (-1,-2) AND f.fid !=22 ORDER BY t.lastpost DESC LIMIT 0, 10");
while($rthread = $db->fetch_array($query)) {
$rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
$rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
$rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
if($rthread['highlight']) {
$string = sprintf('d', $rthread['highlight']);
$stylestr = sprintf('b', $string[0]);
$rthread['highlight'] = 'style="';
$rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$rthread['highlight'] .= '"';
} else {
$rthread['highlight'] = '';
}
$new_reply_threadlist[] = $rthread;
}
//随机精华
$hack_cut_str = 28; //标题字数,可调整
$hack_cut_strauthor = 9;
$new_digest_threadlist = array();
$dthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.digest>0 ORDER by rand() DESC LIMIT 0, 10");
while($dthread = $db->fetch_array($query)) {
$dthread['forumname'] = ereg_replace('<[^>]*>','',$dthread['name']);
$dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
$dthread['view_lastposter'] = cutstr($dthread['lastposter'],$hack_cut_strauthor);
$dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
$dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread[lastpost] + ($timeoffset * 3600));
$new_digest_threadlist[] = $dthread;
}
//今日发贴排行
$tomonth=date(n);
$todate=date(j);
$toyear=date(Y);
$time=mktime(0,0,0,$tomonth,$todate,$toyear);
$query=$db->query("select count(pid) as num,authorid,author from $tablepre"."posts where dateline>=$time group by authorid order by num desc limit 0,10");
while($result=$db->fetch_array($query)){
$poststar.="<a href=space.php?uid=".$result[authorid].">".cutstr($result[author],10)."</a> <font color=red>[".$result[num]."]</font> ";
}
//----首页多格代码结束
第三步:修改templates/你使用模板目录下/discuz.htm文件:查找:
< !--{loop $catlist $key $cat}-->
再其下加入如下代码:
<!-- 首页四格代码开始 -->
< div class="mainbox forumlist" style="padding:0;">
< table cellspacing="0" cellpadding="0">
<thead class="category">
<tr>
<td align="center" style="padding:0 1px 0 0"><h3>≡ 论坛图片 ≡</h3></td>
<td align="center" style="padding:0"><h3>≡ 较新帖子 ≡</h3></td>
<td align="center" style="padding:0 1px 0 1px"><h3>≡ 较新回复 ≡</h3></td>
<td align="center" style="padding:0"><h3>≡ 随机精华 ≡</h3></td>
</tr>
</thead>
<tr>
<td width="25%">
< script type="text/javascript" src="pic.php"></script>
< /td>
<td width="25%">
< table border="0" cellpadding="0" cellspacing="0" width="100%">
< tr valign="top">
< td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
< td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
< !--{loop $new_post_threadlist $nthread}-->
< !--{if $nthread[replies]}-->
< div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='较新帖子 {LF}所在论坛: $nthread[forumname]{LF}主题标题: $nthread[subject] {LF}主题作者: $nthread[author]{LF}发表时间: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}之后回复: $nthread[lastreplytime]{LF}{lang lastpost}: $nthread[lastposter]'>$nthread[view_subject]</a></div>
< !--{else}-->
< div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title='较新帖子 {LF}所在论坛: $nthread[forumname]{LF}主题标题: $nthread[subject] {LF}主题作者: $nthread[author]{LF}发表时间: $nthread[date]{LF}浏览次数: $nthread[views] 次 {LF}回复次数: $nthread[replies] 次{LF}之后回复: 暂时没有回复'>$nthread[view_subject]</a></div>
< !--{/if}-->
< !--{/loop}-->
< /td>
< /tr>
< /table>
< /td>
<td width="25%">
< table border="0" cellpadding="0" cellspacing="0" width="100%">
< tr valign="top">
< td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
< td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
< !--{loop $new_reply_threadlist $rthread}-->
< div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$rthread[tid]" $rthread['highlight'] title='较新回复 {LF}所在论坛: $rthread[forumname]{LF}主题标题: $rthread[subject]{LF}主题作者: $rthread[author]{LF}发表时间: $rthread[date]{LF}浏览次数: $rthread[views] 次{LF}回复次数: $rthread[replies] 次{LF}之后回复: $rthread[lastreplytime]{LF}{lang lastpost}: $rthread[lastposter]'>$rthread[view_subject]</a></div>
< !--{/loop}-->
< /td>
< /tr>
< /table>
< /td>
< td width="25%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
< tr valign="top">
< td width="24" style="padding:0;border-top:0px;"><img src="images/list.gif" border="0" /></td>
< td background="images/listbg.gif" style="line-height:20px;padding:0;border-top:0px;background-repeat: repeat-y" width="100%">
< !--{loop $new_digest_threadlist $dthread}-->
< div style="overflow: hidden;height: 20px;width: 100%;"><a href="viewthread.php?tid=$dthread[tid]" $dthread['highlight'] title='随机精华 {LF}所在论坛: $dthread[forumname]{LF}精华级别: $dthread[digest]级{LF}主题标题: $dthread[subject]{LF}主题作者: $dthread[author]{LF}发表时间: $dthread[date]{LF}浏览次数: $dthread[views] 次{LF}回复次数: $dthread[replies] 次{LF}之后回复: $dthread[lastreplytime]{LF}{lang lastpost}: $dthread[lastposter]'>$dthread[view_subject]<a href="redirect.php?tid=$dthread[tid]&goto=lastpost#lastpost" title="转入查看之后回复的内容">($dthread[replies]/$dthread[views])</a></div>
< !--{/loop}-->
< /td>
< /tr>
< /table>
< /td>
</tr>
< tr>
< td colspan=4>今日发贴TOP10:$poststar</td>
< /tr>
< /table>
< /div>
< !-- 首页多格代码结束 -->
更新缓存!恭喜你,安装成功!
本文标签:
很赞哦! ()
图文教程
创建论坛Discuz的方法
1.下载discuz!2. 配置第一个虚拟主机3. 配置mysql,给Discuz!增加一个账户4. 安装Discuz!5. 为某个虚拟主机配置用户认证6. 配置域名跳转
Discuz文件common.js代码分析注释
[Discuz!] (C)2001-2099 Comsenz Inc.This is NOT a freeware, use is subject to license terms
Discuz首页架构分析初步分析
以index.php首页为例,来分析程序的执行过程,脚本语言用包含切割方式来使程序模块化,java在这里就比较严谨,但是明显不如PHP来得简单。
Discuz论坛自动发帖机实现方法
1. 起因:某人在自己的空间搭了个discuz,设置了诸多必须灌水的邪恶规定。本人一向潜水员当惯了当然不爽。a. discuz论坛无任何图片验证码,包括登陆以及发帖的时候。
相关源码
-
(自适应)简繁双语机械矿山矿石五金设备pbootcms源码下载本模板基于PbootCMS开发,主要面向机械五金、矿山矿石设备等行业,支持简体中文和繁体中文双语切换。采用响应式布局技术,确保在各种设备上都能获得良好的浏览体验。模板设计注重展示工业设备的专业性和技术特点,帮助企业建立可靠的线上展示平台。查看源码 -
帝国cms7.5奇闻异事末解之谜模板免费下载带数据本模板基于帝国CMS7.5系统开发,为神秘现象、未解之谜类主题网站设计。包含完整的PC端、移动端及百度MIP站同步生成功能,内置火车头采集规则模块,可快速采集目标站内容资源。整体设计风格神秘大气,符合主题定位。查看源码 -
pbootcms模板(PC+WAP)传媒广告影视公司网站源码基于PbootCMS内核开发的全自适应传媒文化网站模板,为影视公司、广告传媒企业打造,同时支持多行业快速适配。通过替换文字图片即可转换为其他行业网站查看源码 -
(自适应)刷卡pos机数据移动支付设备电子科技pbootcms模板下载本模板为POS机设备制造商、移动支付终端服务商和科技企业设计,基于PbootCMS系统开发,提供完整的在线展示平台解决方案,满足支付设备行业特有的展示需求。查看源码 -
(PC+WAP)蓝色钢结构机械五金工程建筑基建营销型pbootcms模板下载于PbootCMS开发的钢结构与工程机械专用模板,助力企业构建专业级产品展示平台;模板内置工程案例展示、产品参数对照表等专业模块,预设项目进度、施工方案等建筑行业专属栏目查看源码 -
帝国CMS中小学生知识点试题练习题考试源码下载基于帝国CMS后台管理系统,支持在线修改联系信息、网站参数等配置,操作流程简洁明了。专注于中小学教育领域,集成知识点总结、试题练习、考试资讯等学习资源,为师生提供全面的在线学习支持与服务。查看源码
| 分享笔记 (共有 篇笔记) |
