dede织梦图片alt标签自动调用title

温馨提示:DedeCMS用户请及时前往织梦官网处理官方版权事宜。

首页找到目录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']);

OK,修改过之后在更新生成下文章内容就可以了,方法其实很简单。

本文属原创,转载请注明原文:http://www.zhimatong.com/jiaocheng/581.html

为保证教程的实用性及扩大知识面覆盖,如果您有相似问题而未解决,可联系在线客服免费技术支持。

内容有用

相关阅读
关键词:

    联系
    顾问

    在线
    客服
    购物车
    账号登录

    没有账号?立即注册

    忘记密码

    登录即同意用户协议没有账号? 立即注册
    账号注册
    我已阅读并同意用户协议
    立即注册
    注册即同意用户协议已有账号? 立即登录
    找回密码

    操作步骤:邮箱验证->设置新密码

    注册即同意用户协议已有账号? 立即登录