pbootcms自带sitemap.xml增加tag标签链接实现方法

资源来源网络,如需授权,请更换源码,模块仅供学习,如需商用请购买正版授权,本栏目不提供技术服务,积分不够请签到!如何签到?系统升级暂停签到,恢复关注公告!
如遇下载链接蓝奏网盘打不开lanzous替换成lanzoux尝试! 广告

打开/apps/home/model/SitemapModel.php文件,在78行后面增加个指定分类标签调用代码:
// 指定分类标签调用
public function getSortTags($scode)
{
$join = array(
array(
‘ay_content_sort b’,
‘a.scode=b.scode’,
‘LEFT’
),
array(
‘ay_model c’,
‘b.mcode=c.mcode’,
‘LEFT’
)
);

$scode_arr = array();
if ($scode) {
// 获取所有子类分类编码
$this->scodes = array(); // 先清空
$scodes = $this->getSubScodes(trim($scode)); // 获取子类

// 拼接条件
$scode_arr = array(
“a.scode in (” . implode_quot(‘,’, $scodes) . “)”,
“a.subscode=’$scode'”
);
}
$result = parent::table(‘ay_content a’)->where(‘a.status=1’)->where(“c.type=2 AND a.tags<>””)
->where($scode_arr, ‘OR’)
->join($join)
->order(‘a.visits DESC’)
->column(‘a.tags’);
return $result;
}
打开/apps/home/controller/SitemapController.php文件,在73行后面增加
if (! ! $rs = $this->model->getSortTags(”)) {
$tags = implode(‘,’, $rs); // 把栏目tags串起来 AB模板网
$tags = array_unique(explode(‘,’, $tags)); // 再把所有tags组成数组并去重
foreach ($tags as $key2 => $value2) {
if (! in_array($value2, array_column($data, ‘tags’))) { // 避免重复输出
$url_rule_type = $this->config(‘url_rule_type’) ?: 3;
if ($url_rule_type == 3) {
$link2 = Url::home(‘tag=’ . urlencode($value2), ”);
} else {
$link2 = Url::home(‘tag/’ . urlencode($value2));
}
$str .= $this->makeNode($link2, date(‘Y-m-d’), ‘0.80’);
}
}
}
访问sitemap.xml就可以看到里面生成的附带了tag的链接地址,以上便是风格酷模板网关于pbootcms自带sitemap.xml增加tag标签链接实现方法希望对您有所帮助。

©下载资源版权归作者所有;本站所有资源均来源于网络,仅供学习使用,请支持正版!
风格酷模板网 » pbootcms自带sitemap.xml增加tag标签链接实现方法
NOTICE:【咨询风格酷】客服QQ:1131734965
NOTICE:【咨询风格酷】客服微信:wwwxmamnet
NOTICE:【风格酷模板网②群】QQ群:288678775
☉免责声明:本站所有模板均来自用户分享和网络收集,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服,我们核实后会立即删除。
☉如果源码网盘地址失效!或有其他问题,请点我报错,谢谢合作!
☉人民币与积分汇率为1比10,即1元=10积分.有任何疑问请联系客服
☉如有其他问题,请加网站客服QQ(1131734965)进行交流。
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!
☉源码、模板等资源会随着技术、环境的升级而存在部分问题,还请慎重选择。

发表评论

风格酷模板网www.xmam.net分享优质网站模板

立即查看 了解详情