-
自動化儀表流量計智能水...
-
日用百貨外貿(mào)類網(wǎng)站pb...
-
電子產(chǎn)品類網(wǎng)站pbootcms模...
-
機械電子產(chǎn)品類網(wǎng)站pb...
-
戶外露營設(shè)備類網(wǎng)站pb...
-
茶葉資訊類網(wǎng)站pbootcms模...
-
數(shù)控車床類網(wǎng)站pbootcms模...
-
潮流資訊信息類網(wǎng)站pb...
-
創(chuàng)業(yè)資訊文章博客類網(wǎng)站...
-
五金機械加工設(shè)備類網(wǎng)站...
-
協(xié)議合同類網(wǎng)站pbootcms模...
-
金融資本咨詢推廣落地頁...
-
塑膠板材類網(wǎng)站pbootcms模...
-
五金配件加工機械設(shè)備類...
-
玩具動漫類網(wǎng)站pbootcms模...
-
合同范文類網(wǎng)站pbootcms模...
-
酒店管理系統(tǒng)類網(wǎng)站pb...
-
減速機設(shè)備類外貿(mào)網(wǎng)站...
-
床上用品類網(wǎng)站pbootcms模...
-
園林花卉種植類網(wǎng)站pb...
2、打開/apps/home/controller/SitemapController.php文件,在73行后面增加// 指定分類標(biāo)簽調(diào)用
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模板網(wǎng)
$tags = array_unique(explode(',', $tags)); // 再把所有tags組成數(shù)組并去重
foreach ($tags as $key2 => $value2) {
if (! in_array($value2, array_column($data, 'tags'))) { // 避免重復(fù)輸出
$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');
}
}
}


