pbootcms模板修改tags實現(xiàn)keywords內(nèi)容關(guān)聯(lián)匹配
根據(jù)keywords關(guān)鍵字來做匹配在文章詳情頁里顯示相關(guān)內(nèi)容,同樣帶有一樣的關(guān)鍵字的。
打開/apps/home/controller/ParserController.php文件
找到
// tags數(shù)據(jù)參數(shù)篩選
? ? ? ? ? ? ? ?$where2 = array();
? ? ? ? ? ? ? ?if ($tags) {
? ? ? ? ? ? ? ? ? ?$tags_arr = explode(',', $tags);
? ? ? ? ? ? ? ? ? ?foreach ($tags_arr as $value) {
? ? ? ? ? ? ? ? ? ? ? ?if ($value) {
? ? ? ? ? ? ? ? ? ? ? ? ? ?if ($fuzzy) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?$where2[] = "a.tags like '%" . escape_string($value) . "%'";
? ? ? ? ? ? ? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?$where2[] = "a.tags='" . escape_string($value) . "'";
? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?}
改成
// tags數(shù)據(jù)參數(shù)篩選
$where2 = array();
if ($tags) {
? ? $tags_arr = explode(',', $tags);
? ? foreach ($tags_arr as $value) {
? ? ? ? if ($value) {
? ? ? ? ? ? if ($fuzzy) {
? ? ? ? ? ? ? ? $where2[] = "a.keywords like '%" . escape_string($value) . "%'";
? ? ? ? ? ? } else {
? ? ? ? ? ? ? ? $where2[] = "a.keywords='" . escape_string($value) . "'";
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
在詳情頁里列表調(diào)用代碼參考以下,增加tags={content:keywords}即可
調(diào)用代碼如下:
{pboot:list scode=2 num=4 tags={content:keywords}}
<a href="[list:link]"><img src="[list:ico]" class="wwwadminbuycn" alt="[list:title]" /></a>
{/pboot:list}

更多pbootcms模板教程:https://www.91084.com/pbootcms/
pbootcms網(wǎng)站模板下載:https://www.91084.com/