DedeCMS织梦模板为文章图片自动添加ALT标签

  用DedeCMS在做图片站,一般都是采集,很多图片没有alt标签,对搜索引擎来说并不友好,一张一张写相当麻烦,可以修改为文档关键字或文章标题作为图片alt描述。图片的匹配度当然没有手动的好,但做站群的时候能省事就好。

  修改文件include/arc.archives.class.php

  找到

  //设置全局环境变量

  $this->Fields[‘typename’] = $this->TypeLink->TypeInfos[‘typename’];

  SetSysEnv($this->Fields[‘typeid’],$this->Fields[‘typename’],$this->Fields[‘aid’],$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[‘keywords’].” . “.$this->Fields[‘title’].”‘ “,$this->Fields[‘body’]);</p>
<p>  //end</p>
<p>  重新生成文章即可,如果是其它字段,可以修改$this->Fields[‘body’] 为其它的字段名。</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/4613.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="4613" 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/4611.html" rel="prev">dedecms怎么给第一个li加class</a></span>
<span class="article-nav-next">下一篇<br><a href="https://www.dhtlly.com/4615.html" rel="next">dede列表页分页英文调用方法</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/4085.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/3.jpg&h=200&w=300&zc=1&a=c&q=100&s=1" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="织梦在任意标签中调用系统基本参数的办法">  
</a>
</div>
<div class="entry-star"><a href="javascript:;" title="收藏文章" etap="star" data-postid="4085" 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/4085.html" title="织梦在任意标签中调用系统基本参数的办法" rel="bookmark">织梦在任意标签中调用系统基本参数的办法</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/439.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/19.jpg&h=200&w=300&zc=1&a=c&q=100&s=1" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="分享ucenter整合DedeCMS与Discuz论坛教程">  
</a>
</div>
<div class="entry-star"><a href="javascript:;" title="收藏文章" etap="star" data-postid="439" 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/439.html" title="分享ucenter整合DedeCMS与Discuz论坛教程" rel="bookmark">分享ucenter整合DedeCMS与Discuz论坛教程</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/983.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自定义表单如何限制垃圾信息同IP24小时只能发布一次">  
</a>
</div>
<div class="entry-star"><a href="javascript:;" title="收藏文章" etap="star" data-postid="983" 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/983.html" title="dedecms自定义表单如何限制垃圾信息同IP24小时只能发布一次" rel="bookmark">dedecms自定义表单如何限制垃圾信息同IP24小时只能发布一次</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/3748.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/19.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="3748" 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/3748.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