<div id="search_list"> {@res.search table='%s_content' field='id,title,description,url' fulltext='ft_content' where='status=1' order='temp_score desc,id desc' number='10'} {#foreach($res as $rs)} <div> <a href="{DIR}{$rs[url]}">{$rs[title]}</a> <p>{$rs[description]}</p> </div> {#endforeach} </div> <div>{$res_pagelist code='html'}</div>
读取表中的全文检索字段,并返回最符合条件的搜索结果,支持模糊搜索;本查询系统是基于二元分词法开发制作,仅适用于特定的查询应用。
属性值,标注*的是必须填写的属性值
* table:要查询的数据库表名
* field:要显示的字段列表,不能用*,必须填写
* fulltext:全文检索字段
where:条件检索
order:排序方式
number:搜索结果每页显示数,默认为20
pagelist:分页列表结构,默认为 <p class="k_pagelist">{$standard}{$next}</p>,【详见这里】
搜索表单:
<form id="search" action="{DIR}search/" method="get"> <input type="hidden" value="1" name="space" /> <input type="hidden" value="10" name="rn" /> <input type="text" name="q" class="input" value="{?=empty($_GET['q'])?'':htmlspecialchars($_GET['q'])?}"maxlength="100" /> <input value="搜索" type="submit" name="b" alt="search" width="60" class="btn" height="19" border="0" value="<?=kc_val($_GET,'b')?>"/> </form>
转载请注明出处:唯众网络