您现在的位置是:首页 > 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>

本文标签:

很赞哦! ()

相关源码

  • pbootcms模板(PC+WAP)APP应用软件下载类官网源码为APP应用软件官网打造的响应式解决方案,PC端与移动端(WAP)数据实时同步,一次更新全网生效,满足多终端用户无缝体验需求。查看源码
  • (PC+WAP)红色厨具厨房用品设备pbootcms模板源码下载为厨具设备企业设计的响应式网站模板,采用PbootCMS内核开发,适用于商用厨房设备、家用厨具、厨房用品等企业展示。模板包含产品展示、新闻动态、案例中心等标准模块,助您快速搭建专业级行业网站。查看源码
  • 帝国CMS7.5漫画网站模板带手机端源码免费下载本模板为漫画内容平台设计开发,采用帝国CMS7.5内核构建,深度优化漫画作品展示结构与章节管理模式。前端采用响应式布局设计,适配各类漫画阅读场景,提供作品分类、连载追踪、热度排行等垂直领域功能模块。查看源码
  • (自适应响应式)黑色LED显示屏户外广告屏网站源码下载这是一款基于PbootCMS内核开发的响应式网站模板,专门为LED显示屏及户外广告行业打造。模板适配各类显示设备,帮助企业快速搭建专业官网,展示产品与服务优势,有效提升品牌形象。查看源码
  • (自适应响应式)高端珠宝首饰奢侈品pbootcms模板下载本模板为珠宝首饰及奢侈品行业打造,采用PbootCMS内核开发,具备卓越的视觉表现力与商业转化能力。自适应设计确保在手机端呈现产品细节,后台数据实时同步,助您高效展示钻石查看源码
  • (自适应)证书授权书防伪查询系统pbootcms模板本模板基于PbootCMS系统开发,为各类证书查询机构设计,可快速构建高效安全的证书核验平台。采用响应式布局技术,自动适配手机端操作,支持批量导入证书数据,提供便捷的查询接口,满足机构证书管理及用户在线核验需求。查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐