Dede5.7文章图片alt自动调用文章标题的方法

来自:网络
时间:2020-11-04
阅读:
免费资源网 - https://freexyz.cn/

在网站中图片有alt无论是对网站还是对搜索引擎都是有好处的,之前给也大家介绍过,但是想要alt自动调用文章标题还要再做调整。  

找到 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');

后面加上如下代码:  

//替换文章BODY 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']);

 以上就是关于DedeCMS5.7文章图片alt自动调用文章标题的修改方法,大家有任何不明白的可联系免费资源网小编一起讨论。

免费资源网 - https://freexyz.cn/
返回顶部
顶部