国产福利在 线观看视频,一区二区高清在线视频免费观看,狠狠色噜噜狠狠狠888米奇,国产一区欧美二区,国产又黄又爽的老大爷,成人久久精品二区,国内精品国产三级国产v另类,夜夜操视频 一区 二区

YZMCMS內容管理系統

首頁 > 動態

YzmCMS V6.3新增搜索標簽(m:search)

來源:原創    2022-09-14 14:36:08   編輯:管理員   瀏覽:3717

YzmCMS V6.3最新版更新了非常多的功能,其中就包括新增了 搜索標簽(m:search),在新的版本中搜索頁模板(search.html)的標簽必須使用 搜索標簽 才可以進行搜索,本文主要介紹搜索標簽的使用:

搜索標簽(search):

{m:search field="id,catid,title,updatetime,thumb,url,color,flag,description" keyword="$q" siteid="$siteid" modelid="$modelid" limit="10" page="page"}
屬性說明:
field ---- 查詢的字段名
keyword --- 搜索的關鍵字,keyword="$q" 為固定寫法,無需修改
siteid --- 站點ID,siteid="$siteid" 為固定寫法,無需修改
modelid --- 模型ID,modelid="$modelid" $modelid表示自動獲取模型,也可以手動指定
search --- 指定搜索字段,默認只搜索標題符合搜索條件的,如search="title,content",非全部模型時有效 (YzmCMS V6.6新增屬性)
order --- 排序規則,可自由修改,例如: order="id ASC"
limit --- 顯示條數,可自由修改,例如:limit="20"
page --- 分頁屬性,page="page" 為固定寫法,無需修改,如不需要分頁,請不要用該屬性

search屬性解釋:系統默認僅支持標題搜索,搜索多個字段將大大降低系統搜索效率,加大搜索時間,特殊需求想搜索標題和內容符合條件的,就可以使用 search="title,content" ,非全部模型時有效 (YzmCMS V6.6新增屬性)


在 YzmCMS V6.3及以后版本,搜索頁模板(search.html)的標簽 必須使用 搜索標簽(m:search) 才可以進行搜索,升級后,請自行修改模板標簽。


舊版用法:

<h2>“{$q}” 的搜索結果,共<span>{$total}</span>條</h2>
{loop $search_data $v}
{php $v['color_title'] = str_ireplace($q, "<span style='color:red;'>$q</span>", $v['title']);}
{php $v['description'] = str_ireplace($q, "<span style='color:red;'>$q</span>", $v['description']);}
<div class="yzm-news">
	<a href="{$v[url]}" class="yzm-news-img">
		<img src="{get_thumb($v['thumb'])}" alt="{$v[title]}" title="{$v[title]}" />
	</a>
	<div class="yzm-news-right">
		{if strstr($v['flag'],'1')}<em>頂</em>{/if} <!-- 內容屬性 -->
		<a href="{$v[url]}">{$v[color_title]}</a>
		<p>{$v[description]}</p>
		<div class="yzm-news-tags">
			{php $aid = $v['id'];}
			{m:get sql="SELECT id,tag FROM yzm_tag_content AS a LEFT JOIN yzm_tag AS b ON a.tagid=b.id WHERE aid=$aid" limit="5" return="tag_data"}
			{loop $tag_data $val}	
			<a href="{tag_url($val['id'])}" target="_blank" >{$val[tag]}</a>
			{/loop}
		</div>
	</div>
</div>		
{/loop}

新版用法:

{m:search field="id,catid,title,updatetime,thumb,url,color,flag,description" keyword="$q" siteid="$siteid" modelid="$modelid" limit="10" page="page"}
<h2>“{$q}” 的搜索結果,共{php echo $tag->total}條</h2>
{loop $data $v}
{php $v['color_title'] = str_ireplace($q, "<span style='color:red;'>$q</span>", $v['title']);}
{php $v['description'] = str_ireplace($q, "<span style='color:red;'>$q</span>", $v['description']);}
<div class="yzm-news">
	<a href="{$v[url]}" class="yzm-news-img">
		<img src="{get_thumb($v['thumb'])}" alt="{$v[title]}" title="{$v[title]}" />
	</a>
	<div class="yzm-news-right">
		{if strstr($v['flag'],'1')}<em>頂</em>{/if} <!-- 內容屬性 -->
		<a href="{$v[url]}">{$v[color_title]}</a>
		<p>{$v[description]}</p>
		<div class="yzm-news-tags">
			{php $tag_data = content_list_tag($v['catid'], $v['id']);}
			{loop $tag_data $val}	
			<a href="{tag_url($val['id'])}" target="_blank" >{$val[tag]}</a>
			{/loop}
		</div>
	</div>
</div>		
{/loop}


傳送門:YzmCMS標簽大全:http://www.xtremeartistry.com/dongtai/30.html