您现在的位置是:首页 > cms教程 > Discuz教程Discuz教程

discuz个人空间主题列表图片模式实现方法代码实例

冰萍2025-07-06Discuz教程已有人查阅

导读discuz X3空间主题列表 图片展现模式,discuz实现个人空间主题列表调用图片模式,discuz home图片列表如果需要实现该呈现方式,我们需要首先了解discuz封面图片存储原理:

discuz X3空间主题列表 图片展现模式,discuz实现个人空间主题列表调用图片模式,discuz home图片列表如果需要实现该呈现方式,我们需要首先了解discuz封面图片存储原理:
discuz没有将主题列表封面路径存在数据表中,只是在pre_forum_thread表中存了一个cover标识。然后用getthreadcover 函数调取,diy调用的图片也会产生缩略图,可以设置缩略图的质量。
封面图片存储路径格式:data/attachment/forum/threadcover/43/ec/81.jpg
getthreadcover 函数:
function getthreadcover($tid, $cover = 0, $getfilename = 0) {
global $_G;
if(empty($tid)) {
return '';
}
$coverpath = '';
$covername = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'.$tid.'.jpg';
if($getfilename) {
return $covername;
}
if($cover) {
$coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;
}
return $coverpath;
}
文件路径:/source/function/function_forum.php
实现方法:
修改:/source/language/home/lang_template.php
添加like 喜欢或查看
修改:/template/default/home/space_thread.htm
处理封面图:
{eval
$covername = 'threadcover/'.substr(md5($thread[tid]), 0, 2).'/'.substr(md5($thread[tid]), 2, 2).'/'.$thread[tid].'.jpg';
$coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;
}
图片列表
<li style="width: 227px; left: 0px; top: 0px;float:left;">
<div class="c cl">
<a class="z" title="$thread[subject]" onclick="atarget(this)" href="forum.php?mod=viewthread&tid=$thread[tid]">
<img width="203" alt="$thread[subject]" src="{eval echo $coverpath;}">
</a>
</div>
<h3 class="xw0">
<a href="forum.php?mod=viewthread&tid=$thread[tid]" onclick="atarget(this)" target="_blank" {if $thread['displayorder'] == -1}class="recy"{/if}>$thread[subject]</a>
</h3>
<div class="auth cl">
<cite class="xg1 y">
{lang like}: <em>$thread[views]</em> {lang reply}: <a title="0 回复" href="forum.php?mod=viewthread&tid=$thread[tid]">$thread[replies]</a>
</cite>
<a href="home.php?mod=space&uid=$thread[authorid]" target="_blank">$thread[author]</a>$thread[dateline]</div>
</li>

本文标签:

很赞哦! ()

相关源码

  • (自适应HTML5)响应式智能设备人工智能机器pbootcms源码免费下载这款基于PbootCMS开发的网站模板为人工智能和智能设备行业设计,采用现代化科技风格,突出产品的智能特性和技术创新。模板架构合理,功能完善,能够有效展示各类智能产品的核心功能和解决方案。查看源码
  • (PC+WAP)化工材料企业环保能源绿色营销型pbootcms模板源码下载本模板为化工材料及环保能源企业设计,采用PbootCMS开发,可展示各类化工产品、环保技术及能源解决方案。查看源码
  • (自适应)帝国cms7.5模板新闻资讯门户带会员中心基于帝国CMS7.5内核开发的HTML5响应式模板,为新闻机构、媒体门户及资讯聚合平台设计。通过模块化布局实现图文混排查看源码
  • (自适应)中英文双语外贸扬声器音响喇叭话筒网站模板免费下载为音响设备外贸企业设计的中英文双语网站模板,基于PbootCMS内核开发。适配扬声器系统、音频设备等产品的国际化展示需求查看源码
  • (自适应)家禽饲养养殖基地pbootcms模板响应式模板下载为家禽饲养企业、养殖基地设计的响应式网站模板,聚焦畜禽产品展示、养殖技术分享及企业信息服务。采用PbootCMS内核开发,响应式技术确保PC与手机端数据实时同步查看源码
  • 自适应黑色建筑装饰设计公司个人工作室pbootcms模板基于PbootCMS内核开发的黑金风格模板,为建筑装饰、工程设计类企业打造,采用‌开源架构‌,支持跨行业快速适配,核心优势如下: 查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐