设为首页收藏本站

IITT网络服务中心

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3976|回复: 0
打印 上一主题 下一主题

[开发手册] Discuz! x3.2 自定义网站附件图标解决的方案之一

[复制链接]

453

主题

399

帖子

1762

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1762
跳转到指定楼层
楼主
发表于 2018-3-22 13:57:55 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
修改方法:
找到文件:./source/function/function_attachment.php

如果需要的图标有,就修改红色部分就是的代码,
  1. } elseif(preg_match("/word|powerpoint|^(doc|docx|ppt|xls|xlsx)\t/", $type)) {
  2.    $typeid = 5;
复制代码
就可以显示附件图标:

相关代码是:
  1. static $attachicons = array(
  2.    1 => 'unknown.gif',
  3.    2 => 'binary.gif',
  4.    3 => 'zip.gif',
  5.    4 => 'rar.gif',
  6.    5 => 'msoffice.gif',
  7.    6 => 'text.gif',
  8.    7 => 'html.gif',
  9.    8 => 'real.gif',
  10.    9 => 'av.gif',
  11.    10 => 'flash.gif',
  12.    11 => 'image.gif',
  13.    12 => 'pdf.gif',
  14.    13 => 'torrent.gif'
  15.   );
复制代码
如果需要加入新图标,则需要上传图标文件到响应的文件夹:



上传图标至响应目录  文件根目录/static/image/filetype/dwg.gif

完了修改相应增加的文件代码,红色部分
  1. static $attachicons = array(
  2.    1 => 'unknown.gif',
  3.    2 => 'binary.gif',
  4.    3 => 'zip.gif',
  5.    4 => 'rar.gif',
  6.    5 => 'msoffice.gif',
  7.    6 => 'text.gif',
  8.    7 => 'html.gif',
  9.    8 => 'real.gif',
  10.    9 => 'av.gif',
  11.    10 => 'flash.gif',
  12.    11 => 'image.gif',
  13.    12 => 'pdf.gif',
  14.    13 => 'dwg.gif',
  15.    14 => 'torrent.gif'


  16. } else {
  17.   if(preg_match("/bittorrent|^torrent\t/", $type)) {
  18.    $typeid = 14;
  19.   } elseif(preg_match("/dwg|^dwg\t/", $type)) {
  20.    $typeid = 13;
  21.   } elseif(preg_match("/pdf|^pdf\t/", $type)) {
  22.    $typeid = 12;
  23.   } elseif(preg_match("/image|^(jpg|gif|png|bmp)\t/", $type)) {
  24.    $typeid = 11;
复制代码

完成后就会出现添加的图标,如图效果
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|IITT网络服务中心    

GMT+8, 2024-4-19 23:40 , Processed in 0.070225 second(s), 27 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

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