设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 创业者 手机 数据
当前位置: 首页 > 服务器 > 系统 > 正文

dedecms织梦给图片添加Alt和Title属性的方法

发布时间:2021-11-18 10:03 所属栏目:52 来源:互联网
导读:搜索引擎对织梦dedecms图片的认知就是图片添加的属性,在织梦后天上传图片的时候是不会添加属性的,虽然也有title选项,但是是没有效果的,想要添加属性还要在配置文件中做出相应的修改。 打开include/arc.archives.class.php文件 找到以下代码(一般在第204

搜索引擎对织梦dedecms图片的认知就是图片添加的属性,在织梦后天上传图片的时候是不会添加属性的,虽然也有title选项,但是是没有效果的,想要添加属性还要在配置文件中做出相应的修改。
打开include/arc.archives.class.php文件
找到以下代码(一般在第204行):
//设置全局环境变量
$this->Fields['typename'] = $this->TypeLink->TypeInfos['typename'];
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');
}
//完成附加表信息读取
unset($row);
然后在
@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives'); 
下面添加以下代码(“织梦中国网”就是你想要更换的图片名称):
$this->Fields['body'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",织梦中国网' ",$this->Fields['body']);
$this->Fields['imgurls'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",织梦中国网' ",$this->Fields['imgurls']);
$this->Fields['introduce'] = str_ireplace("<img " ,"<img alt='".$this->Fields['title'].",织梦中国网' ",$this->Fields['introduce']);

(编辑:ASP站长网)

    网友评论
    推荐文章
      热点阅读