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

搜索引擎对织梦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']);
dedecms织梦给图片添加Alt和Title属性的方法

dawei

【声明】:邵阳站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。