dedecms织梦给图片添加Alt和Title属性的方法
发布时间:2021-11-19 06:36:04 所属栏目:系统 来源:互联网
导读:搜索引擎对织梦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']); ![]() (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐
热点阅读