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="entry-tags">
<a href="https://www.dhtlly.com/tag/dedecms" rel="tag">
dedecms      </a>
<a href="https://www.dhtlly.com/tag/dede%e6%a8%a1%e6%9d%bf" rel="tag">
dede模板      </a>
<a href="https://www.dhtlly.com/tag/%e7%bb%87%e6%a2%a6cms" rel="tag">
织梦cms      </a>
</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/1949.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="1949" 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/1947.html" rel="prev">dedecms如何设置让文件调用或超链接使用绝对路径</a></span>
<span class="article-nav-next">下一篇<br><a href="https://www.dhtlly.com/1951.html" rel="next">织梦Dedecms在循环列表中获取会员信息的方法</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/1037.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/17.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="1037" 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/1037.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/1423.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/5.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="1423" 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/1423.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/1947.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/14.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="1947" 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/1947.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/276.html">
<img class="lazyload" data-src="https://www.dhtlly.com/wp-content/themes/ripro/timthumb.php?src=http://blog.163.com/nicol.bao@126/blog/%5Bfield:litpic/%5D&h=200&w=300&zc=1&a=c&q=100&s=1" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="都找齐了 织梦dede标签:arclist标签使用大全">  
</a>
</div>
<div class="entry-star"><a href="javascript:;" title="收藏文章" etap="star" data-postid="276" 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/276.html" title="都找齐了 织梦dede标签:arclist标签使用大全" rel="bookmark">都找齐了 织梦dede标签:arclist标签使用大全</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/5979.html">pbcms039(电脑手机同版)机械设备制造类公司网站pbootcms模板 制药机器生产商厂家网站源码</a>
</li>
<li>
<a href="https://www.dhtlly.com/5974.html">pbcms038(带手机版同步数据)绿色生态农业企业网站pbootcms模板 农业种植网站源码</a>
</li>
<li>
<a href="https://www.dhtlly.com/5969.html">pbcms037(带手机)黄色工程机械设备网站pbootcms模板 大型工程机械网站源码</a>
</li>
<li>
<a href="https://www.dhtlly.com/5963.html">pbcms036(自适应手机版)响应式供应链网站pbootcms模板 进出口服务企业网站源码</a>
</li>
<li>
<a href="https://www.dhtlly.com/5957.html">pbcms035(自适应手机版)幽默笑话网站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