discuz个人空间主题列表 图片模式实现方法
discuz X3空间主题列表 图片展现模式,discuz实现个人空间主题列表调用图片模式,discuz home图片列表
如果需要实现该呈现方式,我们需要首先了解discuz封面图片存储原理:
discuz没有将主题列表封面路径存在数据表中,只是在pre_forum_thread表中存了一个cover标识。然后用getthreadcover 函数调取,diy调用的图片也会产生缩略图,可以设置缩略图的质量。
封面图片存储路径格式:data/attachment/forum/threadcover/43/ec/81.jpg
getthreadcover 函数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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
处理封面图:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | { 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> |

【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 推荐几款开源且免费的 .NET MAUI 组件库
· 实操Deepseek接入个人知识库
· 易语言 —— 开山篇
· Trae初体验