Discuz教程网

[代码修改] discuz个人空间主题列表 图片模式实现方法

[复制链接]
authicon dly 发表于 2014-4-26 23:33:15 | 显示全部楼层 |阅读模式
discuz 空间主题列表 图片展现模式,discuz实现个人空间主题列表调用图片模式,discuz home图片列表

如果需要实现该呈现方式,我们需要首先了解discuz封面图片存储原理:
discuz没有将主题列表封面路径存在数据表中,只是在pre_forum_thread表中存了一个cover标识。然后用getthreadcover 函数调取,diy调用的图片也会产生缩略图,可以设置缩略图的质量。
封面图片存储路径格式:data/attachment/forum/threadcover/43/ec/81.jpg

getthreadcover 函数:
  1. function getthreadcover($tid, $cover = 0, $getfilename = 0) {
  2.   global $_G;
  3.   if(empty($tid)) {
  4.     return '';
  5.   }
  6.   $coverpath = '';
  7.   $covername = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'.$tid.'.jpg';
  8.   if($getfilename) {
  9.     return $covername;
  10.   }
  11.   if($cover) {
  12.     $coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;
  13.   }
  14.   return $coverpath;
  15. }
  16. 文件路径:/source/function/function_forum.php
复制代码
实现方法:
修改:/source/language/home/lang_template.php
添加like 喜欢或查看

修改:/template/default/home/space_thread.htm
处理封面图:
  1. {eval
  2.   $covername = 'threadcover/'.substr(md5($thread[tid]), 0, 2).'/'.substr(md5($thread[tid]), 2, 2).'/'.$thread[tid].'.jpg';
  3.   
  4.   $coverpath = ($cover < 0 ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$covername;
  5. }

  6. 图片列表
  7. <li style="width: 227px;  left: 0px; top: 0px;float:left;">
  8.   <div class="c cl">
  9.   <a class="z" title="$thread[subject]" onclick="atarget(this)" href="forum.php?mod=viewthread&tid=$thread[tid]">
  10.   <img width="203" alt="$thread[subject]" src="{eval echo $coverpath;}">
  11.   </a>
  12.   </div>
  13.   <h3 class="xw0">

  14.   <a href="forum.php?mod=viewthread&tid=$thread[tid]" onclick="atarget(this)" target="_blank" {if $thread['displayorder'] == -1}class="recy"{/if}>$thread[subject]</a>
  15.   
  16.   </h3>
  17.   <div class="auth cl">
  18.   <cite class="xg1 y">
  19.   {lang like}: <em>$thread[views]</em>   {lang reply}: <a title="0 回复" href="forum.php?mod=viewthread&tid=$thread[tid]">$thread[replies]</a>
  20.   </cite>
  21.   <a href="home.php?mod=space&uid=$thread[authorid]" target="_blank">$thread[author]</a>$thread[dateline]</div>
  22. </li>
复制代码
效果如图: homepic.png


游客,如果您要查看本帖隐藏内容请回复

file:///F:/360data/%E9%87%8D%E8%A6%81%E6%95%B0%E6%8D%AE/%E6%A1%8C%E9%9D%A2/attachment.php?fid=263




上一篇:Discuz积分同步_多论坛用户积分同步解决方案
下一篇:Discuz提醒内容信息不完整问题解决
authicon 爱要唯一 发表于 2014-9-7 16:57:21 | 显示全部楼层
这个功能非常喜欢
authicon 5ucn 发表于 2014-9-15 21:55:41 | 显示全部楼层
[s_catsoul=3]你懂的[/s_catsoul]
authicon zgycgc1 发表于 2015-3-8 16:21:57 | 显示全部楼层
zgycgc  zgycgc  zgycgc
authicon manchy 发表于 2015-3-16 20:29:06 | 显示全部楼层
学习了,谢谢楼主
authicon test 发表于 2015-3-17 10:07:52 | 显示全部楼层
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
authicon lingco 发表于 2015-4-21 14:41:12 | 显示全部楼层
怎么看不懂
authicon zhj466070571 发表于 2015-10-13 17:52:32 | 显示全部楼层
看看怎么弄!!!!!!!!!!!!!!!!!
authicon 天峨885信息网gx 发表于 2015-10-13 21:34:05 | 显示全部楼层
这个功能非常喜欢
authicon wolfstray 发表于 2016-4-6 14:20:01 | 显示全部楼层
很好的主题,看看能行么
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2024-3-29 10:19

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表