-
猫粮狗粮类网站pbootcms模...
-
数字展厅展馆类网站pb...
-
电子元件类网站pbootcms模...
-
环保设备企业类网站pb...
-
客房酒店英文外贸类网站...
-
高端建站类网站pbootcms模...
-
农机设备类网站pbootcms模...
-
自考考试远程教育机类网...
-
工商注册财务公司代理记...
-
站长博客类网站pbootcms模...
-
新闻资讯博客通用类网站...
-
智能安防监控类网站pb...
-
户外露营设备类网站pb...
-
汽车零件配件类网站pb...
-
风景摄影类网站pbootcms模...
-
新闻资讯类网站pbootcms模...
-
站长资讯类网站pbootcms模...
-
跨境电商新闻博客类网站...
-
刑事辩护法律资讯类网站...
-
茶叶资讯类网站pbootcms模...
2、打开/apps/home/controller/SitemapController.php文件,在73行后面增加// 指定分类标签调用
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;
}
然后再次访问sitemap.xml就可以看到里面生成的附带了tag的链接地址。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');
}
}
}


