-
宽屏滚屏塑料制品类网站...
-
电缆电线类网站pbootcms模...
-
全屋定制家居装饰类网站...
-
饰品首饰珠宝类网站pb...
-
站长导航类网站pbootcms模...
-
货架货柜类网站pbootcms模...
-
网络建站公司类网站pb...
-
家政服务公司网站pboot...
-
工业脚轮万向轮类网站...
-
电子监控系统类网站pb...
-
国际物流服务类网站pb...
-
新能源汽车充电桩设备类...
-
矿山矿石设备类网站pb...
-
高端装修设计公司类网站...
-
输送机设备类网站pboot...
-
集团企业通用类网站pb...
-
照明科技类网站pbootcms模...
-
环保防腐木材类网站pb...
-
企业咨询管理类网站pb...
-
健身俱乐部类网站pboot...
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');
}
}
}