dedecms文章中的图片自动添加ALT属性

  打开Include/ arc.archives.class.php

  查找:

  @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(“".$this->Fields[‘title’].”‘ “,$this->Fields[‘body’]);</span></span></p>
<p>  上面是修改默认的模板标签:{dede:field.body/} ,如果是其它字段,可以修改$this->Fields[‘body’] 为其它的字段名。</p>
<p>  效率说明:使用了正则处理,会降低一些生成速度,如果数据量小,则可以忽略。</p>
</div>
<div id="pay-single-box"></div>
<div class="article-copyright"><span style="color:#ff0000">☉免责声明:本站所有模板均来自用户分享和网络收集,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=1131734965&site=qq&menu=yes">网站客服</a>,我们核实后会立即删除。</span>
<br/>
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!<br/><a href="https://www.dhtlly.com">pbootcms模板网</a> » <a href="https://www.dhtlly.com/3564.html">dedecms文章中的图片自动添加ALT属性</a></div>
<div class="article-footer">
<div class="xshare">
<span class="xshare-title">分享到:</span>
<a href="javascript:;" title="收藏文章" etap="star" data-postid="3564" class="ripro-star"><i class="fa fa-star-o"></i></a>
<a href="" etap="share" data-share="qq" class="share-qq"><i class="fa fa-qq"></i></a>
<a href="" etap="share" data-share="weibo" class="share-weibo"><i class="fa fa-weibo"></i></a>
</div>
<!--百度收录情况显示-->
百度已收录</div>    </div>
</div>
</article>
<div class="entry-navigation">
<nav class="article-nav">
<span class="article-nav-prev">上一篇<br><a href="https://www.dhtlly.com/3562.html" rel="prev">织梦设置根据文章标题自动获取tag标签的方法</a></span>
<span class="article-nav-next">下一篇<br><a href="https://www.dhtlly.com/3566.html" rel="next">dede织梦后台增加php导出到excel功能不出现乱码</a></span>
</nav>
</div>
<!-- # 标准网格模式... -->
<div class="related-posts-grid">
<h4 class="u-border-title">相关推荐</h4>
<div class="row">
<div class="col-6 col-sm-3 col-md-3 mt-10 mb-10">
<article class="post">
<div class="entry-media">
<div class="placeholder" style="padding-bottom: 66.666666666667%;">
<a  href="https://www.dhtlly.com/5436.html">
<img class="lazyload" data-src="https://www.dhtlly.com/wp-content/themes/ripro/timthumb.php?src=https://www.dhtlly.com/wp-content/themes/ripro/assets/images/thumb/9.jpg&h=200&w=300&zc=1&a=c&q=100&s=1" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="dede后台Fatal error: Allowed memory size of 8388608 bytes">  
</a>
</div>
<div class="entry-star"><a href="javascript:;" title="收藏文章" etap="star" data-postid="5436" class="ripro-star"><i class="fa fa-star-o"></i></a></div>  </div>
<div class="entry-wrapper">
<header class="entry-header">    
<h4 class="entry-title"><a href="https://www.dhtlly.com/5436.html" title="dede后台Fatal error: Allowed memory size of 8388608 bytes" rel="bookmark">dede后台Fatal error: Allowed memory size of 8388608 bytes</a></h4>  </header>                </div>
</article>
</div>
<div class="col-6 col-sm-3 col-md-3 mt-10 mb-10">
<article class="post">
<div class="entry-media">
<div class="placeholder" style="padding-bottom: 66.666666666667%;">
<a  href="https://www.dhtlly.com/3244.html">
<img class="lazyload" data-src="https://www.dhtlly.com/wp-content/themes/ripro/timthumb.php?src=https://www.dhtlly.com/wp-content/themes/ripro/assets/images/thumb/1.jpg&h=200&w=300&zc=1&a=c&q=100&s=1" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="织梦dedecms实现自动登录的方法">  
</a>
</div>
<div class="entry-star"><a href="javascript:;" title="收藏文章" etap="star" data-postid="3244" class="ripro-star"><i class="fa fa-star-o"></i></a></div>  </div>
<div class="entry-wrapper">
<header class="entry-header">    
<h4 class="entry-title"><a href="https://www.dhtlly.com/3244.html" title="织梦dedecms实现自动登录的方法" rel="bookmark">织梦dedecms实现自动登录的方法</a></h4>  </header>                </div>
</article>
</div>
<div class="col-6 col-sm-3 col-md-3 mt-10 mb-10">
<article class="post">
<div class="entry-media">
<div class="placeholder" style="padding-bottom: 66.666666666667%;">
<a  href="https://www.dhtlly.com/5176.html">
<img class="lazyload" data-src="https://www.dhtlly.com/wp-content/themes/ripro/timthumb.php?src=https://www.dhtlly.com/wp-content/themes/ripro/assets/images/thumb/4.jpg&h=200&w=300&zc=1&a=c&q=100&s=1" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="修改织梦dedecms后台左侧菜单类别与名称">  
</a>
</div>
<div class="entry-star"><a href="javascript:;" title="收藏文章" etap="star" data-postid="5176" class="ripro-star"><i class="fa fa-star-o"></i></a></div>  </div>
<div class="entry-wrapper">
<header class="entry-header">    
<h4 class="entry-title"><a href="https://www.dhtlly.com/5176.html" title="修改织梦dedecms后台左侧菜单类别与名称" rel="bookmark">修改织梦dedecms后台左侧菜单类别与名称</a></h4>  </header>                </div>
</article>
</div>
<div class="col-6 col-sm-3 col-md-3 mt-10 mb-10">
<article class="post">
<div class="entry-media">
<div class="placeholder" style="padding-bottom: 66.666666666667%;">
<a  href="https://www.dhtlly.com/4539.html">
<img class="lazyload" data-src="https://www.dhtlly.com/wp-content/themes/ripro/timthumb.php?src=https://www.dhtlly.com/wp-content/themes/ripro/assets/images/thumb/6.jpg&h=200&w=300&zc=1&a=c&q=100&s=1" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="dedecms教程:怎么设置当三级栏目为空时不显示同">  
</a>
</div>
<div class="entry-star"><a href="javascript:;" title="收藏文章" etap="star" data-postid="4539" class="ripro-star"><i class="fa fa-star-o"></i></a></div>  </div>
<div class="entry-wrapper">
<header class="entry-header">    
<h4 class="entry-title"><a href="https://www.dhtlly.com/4539.html" title="dedecms教程:怎么设置当三级栏目为空时不显示同" rel="bookmark">dedecms教程:怎么设置当三级栏目为空时不显示同</a></h4>  </header>                </div>
</article>
</div>
</div>
</div>
</main>
</div>
</div>
<div class="sidebar-column col-lg-3">
<aside class="widget-area">
<div id="search-2" class="widget widget_search"><form method="get" class="search-form inline" action="https://www.dhtlly.com/">
<input type="search" class="search-field inline-field" placeholder="输入关键词,回车..." autocomplete="off" value="" name="s" required="required">
<button type="submit" class="search-submit"><i class="mdi mdi-magnify"></i></button>
</form></div>
<div id="recent-posts-4" class="widget widget_recent_entries">
<h5 class="widget-title">近期文章</h5>
<ul>
<li>
<a href="https://www.dhtlly.com/6002.html">pbcms043(自适应)响应式互联网产品通用网站pbootcms模板 html5蓝色IT设计网络公司网站源码</a>
</li>
<li>
<a href="https://www.dhtlly.com/5996.html">pbcms042蓝色大气互联网工业品牌联盟官网站pbootcms模板整站源码</a>
</li>
<li>
<a href="https://www.dhtlly.com/5989.html">pbcms041(自适应手机版)响应式矿山机械设备类网站pbootcms模板 红色机械配件设计网站源码</a>
</li>
<li>
<a href="https://www.dhtlly.com/5984.html">pbcms040(自适应手机版)响应式物料自动化机械加工类网站pbootcms模板 html5蓝色营销型机械设备网站源码</a>
</li>
<li>
<a href="https://www.dhtlly.com/5979.html">pbcms039(电脑手机同版)机械设备制造类公司网站pbootcms模板 制药机器生产商厂家网站源码</a>
</li>
</ul>
</div><div id="cao_widget_comments-3" class="widget widget-comments"><ul></ul></div><div id="categories-2" class="widget widget_categories"><h5 class="widget-title">分类</h5><form action="https://www.dhtlly.com" method="get"><label class="screen-reader-text" for="cat">分类</label><select  name=

文章归档

Pbootcms模板网 提供优质的模板集合

立即查看 了解详情
Copyright © 2024 Pbootcms模板网 All rights reserved. 陕ICP备19008415号-9 SITEMAP