欢迎来到元素模板ys720.com,本站提供专业的织梦模板PBOOTCMS模板网站模板网站修改/网站仿站
当前位置:主页 > 程序教程 > DEDECMS教程 >
DEDECMS教程

织梦dedecms将文章和图集里图片的ALT注释修改为文章标题的方法

(元素模板) / 2016-12-13 17:11
织梦如何帮文章图片加上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');

在其下边添加

//文章模板中的图片自动添加alt属性为标题
$this->Fields['body'] = str_ireplace(array('alt=""','alt='''),'',$this->Fields['body']);
$this->Fields['body'] = preg_replace("@ [s]{0,}alt[s]{0,}=["'s]{0,}[sS]{0,}["'s] @isU"," ",$this->Fields['body']);
$this->Fields['body'] = str_ireplace("Fields['title']."" ",$this->Fields['body']);
//图集模板中的图片自动添加注释为标题
$this->Fields['imgurls'] = str_ireplace(array('alt=""','alt='''),'',$this->Fields['imgurls']);
$this->Fields['imgurls'] = preg_replace("@ [s]{0,}alt[s]{0,}=["'s]{0,}[sS]{0,}["'s] @isU"," ",$this->Fields['imgurls']);
$this->Fields['imgurls'] = str_ireplace("Fields['title']."" ",$this->Fields['imgurls']);

Copyright @ 2013-2021 元素模板 www.ys720.com All Rights Reserved. 版权所有 元素模板 www.ys720.com