-
中英雙語電動葫蘆類網站...
-
裝修裝飾設計公司類網站...
-
凈水設備類網站pbootcms模...
-
文藝演出策劃類網站pb...
-
貓糧狗糧類網站pbootcms模...
-
食品加工企業類網站pb...
-
博客類網站pbootcms模板...
-
廚房廚具類網站pbootcms模...
-
物業管理類網站pbootcms模...
-
證書查詢系統類網站pb...
-
機械加工制造類網站pb...
-
水泵設備類網站pbootcms模...
-
新聞博客教程資訊類網站...
-
戶外露營設備類網站pb...
-
機械容器類網站pbootcms模...
-
挖土機工程機械設備網站...
-
電腦快修維修類網站pb...
-
財經新聞資訊類網站pb...
-
聲學建材類網站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');
}
}
}




