全站文章搜索

admin 2016-7-14 2324

在后台任意栏目新建一个其他页面 /search/ ,模板文件search.php


搜索表单代码:


<form method=get action="{uri(/search/)}">
	<input type="text" name="keyword"><input type="submit" value="搜索"></form>


模板文件(search.php)中文章查询代码:


{if isset($_GET["keyword"])}{$set=array()}{$set['cid']=0}{$set['keyword']=$_GET["keyword"]}{$articles=alist($set)}{loop $articles['list'] as $a}
    <a href="{$a['link']}">{$a['title']}</a>{/loop}
{/if}


如需分页,请参考模板助手中的分页代码


欢迎联系本站长QQ:3216572
最新回复 (0)
返回
发新帖
作者最近主题: