主页 > 网站建设 > 建站知识 > 织梦dedecms将文章和图集里图片的ALT注释修改为文

织梦dedecms将文章和图集里图片的ALT注释修改为文

POST TIME:2017-11-13 00:06

打开 include/arc.archives.class.php 文件
找到
$this->Fields['typename'] = $this->TypeLink->TypeInfos['typename'];
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');
在其下边添加
//文章模板中的图片自动添加alt属性为标题
$this->Fields['body'] = str_ireplace(array('alt=""','alt=\&;\&;'),'',$this->Fields['body']);
$this->Fields['body'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\&;'\s]{0,}[\s\S]{0,}[\&;'\s] @isU"," ",$this->Fields['body']);
$this->Fields['body'] = str_ireplace("<img " ,"<img alt=\&;".$this->Fields['title']."\&; ",$this->Fields['body']);
//图集模板中的图片自动添加注释为标题
$this->Fields['imgurls'] = str_ireplace(array('alt=""','alt=\&;\&;'),'',$this->Fields['imgurls']);
$this->Fields['imgurls'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\&;'\s]{0,}[\s\S]{0,}[\&;'\s] @isU"," ",$this->Fields['imgurls']);
$this->Fields['imgurls'] = str_ireplace("<img " ,"<img alt=\&;".$this->Fields['title']."\&; ",$this->Fields['imgurls']);



上一篇:织梦dedecms wap手机站给列表页添加两种或多种模板

下一篇:dedecms教程:图集上传图片水印无效的解决方法

收缩
  • 微信客服
  • 微信二维码
  • 电话咨询

  • 400-1100-266