无限星辰工作室-客户无限互联网动力之源

标题: Discuz! x3.2 自定义网站附件图标解决的方案之一 [打印本页]

作者: crx349    时间: 2014-7-28 17:27
标题: Discuz! x3.2 自定义网站附件图标解决的方案之一
修改方法:
找到文件:./source/function/function_attachment.php

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

就可以显示附件图标: (, 下载次数: 2003)

相关代码是:

  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.   );
复制代码


如果需要加入新图标,则需要上传图标文件到响应的文件夹: (, 下载次数: 1996)


上传图标至响应目录  文件根目录/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;
复制代码


完成后就会出现添加的图标,如图效果




欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://www.xmspace.net/) Powered by Discuz! X3.4